sha1

In my repo, how long must the longest hash prefix be to prevent any overlap?

女生的网名这么多〃 提交于 2019-11-30 07:27:29
问题 The --abbrev-commit flag can be used in conjunction with git log and git rev-list in order to show partial prefixes instead of the full 40-character SHA-1 hashes of commit objects. According to the Pro Git book, it defaults to using seven characters but makes them longer if necessary to keep the SHA-1 unambiguous [...] Additionally, short SHAs are at least 4-character long. Still according to the Pro Git book, Generally, eight to ten characters are more than enough to be unique within a

apparently same commits give different sha1, why?

雨燕双飞 提交于 2019-11-30 07:26:05
问题 After re-write of a subtree history from a repository with a script of mine, I compared it with what would do a git filter-branch ... on that same subtree. I see that initial commits have different sha1 although I expected them to be identical (consequence of this is that all commits from both histories have different sha1). Doing a git show --format=raw <commit-sha1> on both commits gives exactly the same output (except for first line, which is commit <commit-sha1> , introducing the result).

windows校验文件的值

こ雲淡風輕ζ 提交于 2019-11-30 02:45:05
Windows校验文件值的三种方式 win键+R键输入cmd调出命令行 查看MD5值: certutil -hashfile 文件名 MD5 查看 SHA1 certutil -hashfile 文件名 SHA1 查看SHA256 certutil -hashfile 文件名 SHA256 来源: https://www.cnblogs.com/cy666/p/11547461.html

How much can you truncate a SHA1 hash and be reasonably sure of having an unique ID?

孤者浪人 提交于 2019-11-30 01:54:46
I am making an application that stores documents and gives each one a UID based on a SHA1 digest of a few things including the timestamp. The digest has a lot of characters, and I want to allow users to identify the documents by using the first x characters of the full digest. What's a good value for x if the number of documents is maybe around 10K - 100K? bdonlan Adapting the formulas on on wikipedia for the Birthday problem , you can approximate the probability of collision as e^(-n^2/(2^(b+1))) , where n is the document count and b is the number of bits. Graphing this formula with n=100,000

Calculate multiple checksums from the same InputStream using DigestInputStream

强颜欢笑 提交于 2019-11-29 22:46:16
问题 I am trying to figure out how to read multiple digests (md5, sha1, gpg) based on the same InputStream using DigestInputStream . From what I've checked in the documentation, it seems to be possible by cloning the digest. Could somebody please illustrate this? I don't want to be re-reading the stream in order to calculate the checksums. 回答1: You could wrap a DigestInputStream around a DigestInputStream and so on recursively: DigestInputStream shaStream = new DigestInputStream( inStream,

MD5 SHA1 SHA256的校验

你。 提交于 2019-11-29 21:36:27
Windows下使用自带certutil工具校验文件MD5、SHA1、SHA256。 Windows下shell(或cmd)中也集成了专门的工具用来校验文件的MD5值、SHA1值、SHA256值的,吼吼吼!命令是: certutil -hashfile xxx MD5 certutil -hashfile xxx SHA1 certutil -hashfile xxx SHA256 xxx表示将验证文件的绝对路径(地址要填对); 来源: https://my.oschina.net/u/4075942/blog/3107091

how would I perform a SHA1 hash on a file?

一笑奈何 提交于 2019-11-29 21:06:36
问题 If I have a file that I want to monitor for any changes (other than looking at the file date stamps etc). How could I perform a SHA1 hash on its contents? I think this is what GIT does, so I just want to learn how to do it 回答1: using (FileStream stream = File.OpenRead(@"C:\File.ext")) { using (SHA1Managed sha = new SHA1Managed()) { byte[] checksum = sha.ComputeHash(stream); string sendCheckSum = BitConverter.ToString(checksum) .Replace("-", string.Empty); } } Calculate the checksum

What checksum algorithm should I use?

北城余情 提交于 2019-11-29 20:34:18
I'm building a system which needs to be able to find if blobs of bytes have been updated . Rather than storing the whole blob (they can be up to 5MBs), I'm thinking I should compute a checksum of it, store this and compute the same checksum a little bit later, to see whether the blog has been updated. The goal is to minimize the following (in that order) : size of the checksum time to compute likeliness of collisions (2 identical checksums happening even if the content has been modified). It is acceptable for our system to have collision not more than 1/1,000,000. The concern is not security,

C#使用SHA1加密类(RSAFromPkcs8)支持1024位和2048位私钥

我与影子孤独终老i 提交于 2019-11-29 19:46:52
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Security.Cryptography; namespace HelloWord.RSA { /// <summary> /// 类名:RSAFromPkcs8 /// 功能:RSA加密、解密、签名、验签 (支持1024位和2048位私钥) /// 详细:该类对Java生成的密钥进行解密和签名以及验签专用类,不需要修改 /// 版本:3.0 /// 日期:2013-07-08 /// 说明: /// 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。 /// </summary> public sealed class RSAFromPkcs8 { /** * RSA最大解密密文大小 * 注意:这个和密钥长度有关系, 公式= 密钥长度 / 8 */ private const int MAX_DECRYPT_BLOCK = 128; /// <summary> /// 签名 /// </summary> /// <param name="content">待签名字符串</param> /

Extract the SHA1 hash from a torrent file

戏子无情 提交于 2019-11-29 19:45:50
I've had a look around for the answer to this, but I only seem to be able to find software that does it for you. Does anybody know how to go about doing this in python? I wrote a piece of python code that verifies the hashes of downloaded files against what's in a .torrent file . Assuming you want to check a download for corruption you may find this useful. You need the bencode package to use this. Bencode is the serialization format used in .torrent files. It can marshal lists, dictionaries, strings and numbers somewhat like JSON. The code takes the hashes contained in the info['pieces']