sha1

Why does Git use the SHA1 of the *compressed* objects rather than the SHA1 of the original objects?

送分小仙女□ 提交于 2019-12-23 07:14:09
问题 I'm just curious as to why this choice was made - it basically rules out changing the compression algorithm used by Git - because it doesn't use the SHA1 of the raw blobs. Perhaps there is some efficiency consideration here. Maybe ZLIB is faster at compressing a file than the SHA1 algorithm is at creating the hash, so therefore compressing before hashing is faster? Here is a link to the original Git READMEby Linus: http://git.kernel.org/?p=git/git.git;a=blob;f=README;h

If you know the length of a string and apply a SHA1 hash to it, can you unhash it?

梦想的初衷 提交于 2019-12-22 13:50:07
问题 Just wondering if knowing the original string length means that you can better unlash a SHA1 encryption. 回答1: No, not in the general case: a hash function is not an encryption function and it is not designed to be reversible. It is usually impossible to recover the original hash for certain. This is because the domain size of a hash function is larger than the range of the function. For SHA-1 the domain is unbounded but the range is 160bits. That means that, by the Pigeonhole principle,

How to checksum the file to be uploaded with javascript?

丶灬走出姿态 提交于 2019-12-22 13:49:11
问题 I want to checksum the files at browser side before uploading, then checksum and compare at server side to make sure the consistent. But how can I get the pure binary data of the file and checksum it? I tried the way below, but doesn't work: let fileSelect = document.getElementById('file') let files = fileSelect.files let file = files[0] var r = new FileReader(); r.onload = function(){ console.log(r.result); }; r.readAsArrayBuffer(file); var file_sha1 = sha1(r.result) 回答1: The library you are

How to compute SHA1 of an array in Linux kernel

倖福魔咒の 提交于 2019-12-22 09:37:11
问题 I'm trying to compute SHA1 of an integer array in the Linux kernel. I have gone through crypto.c / crypto.h and security/integrity/ima/ima_crypto.c but I can't figure out how to init and then update the SHA1 computer. Can someone point me to a tutorial or guide on how to go about doing this? 回答1: There's a pretty good introduction to the linux cryptography api in Documentation/crypto/api-intro.txt. Also check out fs/ecryptfs/crypto.c for a real-life example of how the functions are used. Here

Changing the certificate fingerprint for an existing application

两盒软妹~` 提交于 2019-12-22 09:36:29
问题 I have an existing application that i published in to google play. All was fine, until I have changed a computer and my sha1 fingerprint changed. Is there a possible way to change the sha1 for an existing application in google play developer console? if not, how can I deal with it? Thank you! 回答1: If you remember, when you publish the app first time on your older computer, you generate a key.keystore in order to sign the apk file and publish to google play. You need to have the same file.

How can I generate a Guid from a SHA-1 byte array?

匆匆过客 提交于 2019-12-22 05:33:25
问题 I have this code to generate a SHA-1 hash: SHA1 sha1 = SHA1CryptoServiceProvider.Create(); Byte[] myStringBytes = ASCIIEncoding.Default.GetBytes(myString); Byte[] hash = sha1.ComputeHash(myStringBytes); Is there a way to turn hash into a Guid (type 5, I guess, to be consistent with SHA-1)? 回答1: You could use this C# code based on rfc4122. To prevent link rot, some code here: public static Guid Create(Guid namespaceId, string name) { if (name == null) throw new ArgumentNullException("name"); /

How safely can I assume unicity of a part of SHA1 hash?

て烟熏妆下的殇ゞ 提交于 2019-12-22 04:00:04
问题 I'm currently using a SHA1 to somewhat shorten an url: Digest::SHA1.hexdigest("salt-" + url) How safe is it to use only the first 8 characters of the SHA1 as a unique identifier, like GitHub does for commits apparently? 回答1: To calculate the probability of a collision with a given length and the number of hashes that you have, see the birthday problem. I don't know the number of hashes that you are going to have, but here are some examples. 8 hexadecimal characters is 32 bits, so for about

How should i save my Password?

痞子三分冷 提交于 2019-12-22 01:18:45
问题 I am programming a new site in JSF. At the moment i program the Login. I used md5 some years ago, but with Rainbow Tables i think its noch safe anymore. So, how should i store the Password in the Database ? 回答1: Here is excellent, detailed guide: https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2007/july/enough-with-the-rainbow-tables-what-you-need-to-know-about-secure-password-schemes/ 回答2: The first thing you want to do is look for a pre-built system from your vendor. You

Java SHA-1 hash an unsigned BYTE

我的梦境 提交于 2019-12-22 00:36:22
问题 Hy guys! I have the following problem: I need to hash an unsigned byte in Java which is(would be...) between 0-255. The main problem is that java doesnt have an unsigned Byte type at all. I found a workaround for this, and used int instead of byte with a little modification. The main problem is: Java.securitys Messagedigest.digest function only accepts byte array types, but i would need to give it an int array. Anybody has a simpe workaround for this? I was looking for a third party sha-1

Android Studio获取开发版SHA1值和发布版SHA1值的史上最详细方法

╄→尐↘猪︶ㄣ 提交于 2019-12-21 23:59:45
前言: 今天我想把百度地图的定位集成到项目中来,想写个小小的案例,实现一下,但在集成百度地图时首先要申请秘钥,申请秘钥要用到SHA1值,所以今天就来总结一下怎样去获取这个值吧,希望对大家有帮助。 正常情况下: 一、获取开发版SHA1: 在此我直接用Android Studio提供的命令控制台了,毕竟做Android开发几乎都是用Android Studio了。 1、打开android studio 找到Terminal并打开,或者在最下面找到Terminal 如下图: 2、 输入命令 C: 进入c盘; 3、接着 输入命令 cd Users\Administrator 其中Administrator是自己的用户名 Administrator文件下有个.adnroid文件, 输入命令 cd .android,最后就找到了.android,如图: 4、输入命令 keytool -list -v -keystore debug.keystore 其中debug.keystore是studio默认的keystore,按回车,然后输入秘钥:android(系统默认) 回车(秘钥库口令是看不到的)如下图: 这样就成功获取到开发版的SHA1值了,是不是很简单呀,那是当然! 二、获取发布版的SHA1: 获取发布版的SHA1,跟获取开发版的SHA1的1、2、3步骤一样