sha

Difference in SHA Hash between git hash-object & git hash-object -t

不想你离开。 提交于 2019-12-06 12:10:09
I want to calculate git SHA hash without using the git hash object function, that is I want to use the shasum function to calculate it. I know that for the following case body="tree 491e9405120eaaa57cce3938fd38508d85a5e08b parent 8550f0f1a7e32fb1bb0933b0294c116a8dbe6dce author user <me@example.com> 1390718030 +0000 committer user <me@example.com> 1390718030 +0000 This is a test" echo $body | git hash-object -w --stdin #755481b921f13bcfd731d74287a0c5847519ee81 l=`expr ${#body} + 1` echo -e 'blob $l\0$body' | shasum #755481b921f13bcfd731d74287a0c5847519ee81 hashes are the same. But if I use -t

Hashing text with SHA-256 at Windows Forms

混江龙づ霸主 提交于 2019-12-06 11:14:52
String inputPass = textBox2.Text; byte[] inputBytes = System.Text.Encoding.UTF8.GetBytes(inputPass); byte[] inputHashedBytes = Sha256.ComputeHash(inputBytes); String inputHash = Convert.ToBase64String(inputHashedBytes); I'm getting some strange output: Q9nXCEhAn7RkIOVgBbBeOd5LiH7FWFtDFJ22TMLSoH8= By output hash looks like this: 43d9d70828409fb46420e56005b05e38de4b887ec5585b43149db64cc2d2a07f // this is where you get the actual binary hash byte[] inputHashedBytes = Sha256.ComputeHash(inputBytes); // but you want it in a string format, similar to a variety of UNIX tools string result =

How to efficiently hash (SHA 256) in golang data where only the last few bytes changes

让人想犯罪 __ 提交于 2019-12-06 06:57:17
问题 Assuming you had 80 bytes of data and only the last 4 bytes was constantly changing, how would you efficiently hash the total 80 bytes using Go. In essence, the first 76 bytes are the same, while the last 4 bytes keeps changing. Ideally, you want to keep a copy of the hash digest for the first 76 bytes and just keep changing the last 4. 回答1: You can try the following examples on the Go Playground. Benchmark results is at the end. Note: the implementations below are not safe for concurrent use

How SHA and SHA1 certificates secure an API on your Android app like Facebook does?

馋奶兔 提交于 2019-12-06 04:21:40
I know what is a SHA and SHA1 cryptographic algorithm. I also know how to genarate these from a computer. But I have searched a lot on the internet and still unable to get a proper explanation on how using these keys will secure an API that you are using on an Android app? For example, Facebook needs your SHA1 key from your system along with your app's package name to be entered on their developer console and their API doesn't work on your app if the key you entered is wrong. How does this mechanism work? How do they verify this on your App? Facebook is leveraging Android application signing

Are there any slow Javascript hashing algorithms like bcrypt?

不羁的心 提交于 2019-12-06 02:43:12
问题 I'm not talking about server-side node.js. I want to use a slow hashing algorithm for a key on the client-side of my site. I have found implementations of SHA-256 which seem to be reliable. I also found this question which lead to the OP creating his own library. However, I'm not sure if I should just do multiple rounds of SHA hashing or trust some of that code since I'm not a security expert and it doesn't seem to have a large following only being "stared" by 36 people. What is the best

Code example for C# and Javascript SHA256 hashing

主宰稳场 提交于 2019-12-06 02:19:16
I have an algorithm in C# running on server side which hashes a base64-encoded string. byte[] salt = Convert.FromBase64String(serverSalt); // Step 1 SHA256Managed sha256 = new SHA256Managed(); // Step 2 byte[] hash = sha256.ComputeHash(salt); // Step 3 Echo("String b64: " + Convert.ToBase64String(hash)); // Step 4 The hash is then checked against a database list of hashes. I'd love to achieve the same with javascript, using the serverSalt as it is transmitted from C# through a websocket. I know SHA-256 hashes different between C# and Javascript because C# and Javascript have different string

The fingerprint you specified is already used by an Android OAuth2 client ID in this project or another project

亡梦爱人 提交于 2019-12-05 21:22:40
I noticed my SHA1 number showing from the gradle view signing report in android studio was different from the one I had originally. I thought maybe it was from changing computers a year ago. My game app was still able to access leaderboards and achievements. I when to my Google API dashboard I noticed the 'OAuth client' had my old SHA1. It wouldn't let me change it to my new SHA1, saying it 'had already been used by this client or another client', although I had no other clients. The mysterious 'Anroid client 1' and 'Android client 2' had neither the old or new SHA1. Underneath the 'OAuth

Jenkins Invalid Git Revisions

北战南征 提交于 2019-12-05 20:57:35
In Jenkins I'm using the XML API to get the SHA(s) of a commit, e.g. http://jenkins/view/job/test/470/api/xml?xpath=//lastBuiltRevision/SHA1&wrapper=SHAS I put it in a wrapper because often it contains more than one SHA and I'm going to process these further. However one of the SHAs always is invalid... <SHAS> <SHA1>cbf26ebac6b4b3860a794c0b1ad86758e7757a3a</SHA1> <SHA1>7e861132ce428911585a818107ba35c44cf12bbf</SHA1> </SHAS> The second SHA is fine but when I check the first SHA here on our GIT repo commits it leads to an error page: Commit 'cbf26ebac6b4b3860a794c0b1ad86758e7757a3a' does not

Fast hash function with collision possibility near SHA-1

核能气质少年 提交于 2019-12-05 17:30:26
问题 I'm using SHA-1 to detect duplicates in a program handling files. It is not required to be cryptographic strong and may be reversible. I found this list of fast hash functions https://code.google.com/p/xxhash/ What do I choose if I want a faster function and collision on random data near to SHA-1? Maybe a 128 bit hash is good enough for file deduplication? (vs 160 bit sha-1) In my program the hash is calculated on chuncks from 0 - 512 KB. 回答1: Maybe this will help you: https:/

What does “vperm v0,v0,v0,v17” with unused v0 do?

主宰稳场 提交于 2019-12-05 11:17:42
I'm working on an SHA-256 implementation using Power8 built-ins . The performance is off a bit. I estimate it is off by about 2 cycles per byte (cpb). The C/C++ code to perform SHA on a block looks like so: // Schedule 64-byte message SHA256_SCHEDULE(W, data); uint32x4_p8 a = abcd, e = efgh; uint32x4_p8 b = VectorShiftLeft<4>(a); uint32x4_p8 f = VectorShiftLeft<4>(e); uint32x4_p8 c = VectorShiftLeft<4>(b); uint32x4_p8 g = VectorShiftLeft<4>(f); uint32x4_p8 d = VectorShiftLeft<4>(c); uint32x4_p8 h = VectorShiftLeft<4>(g); for (unsigned int i=0; i<64; i+=4) { const uint32x4_p8 k =