sha

Failing mocha test on hash of favicon static image

做~自己de王妃 提交于 2019-12-23 17:55:34
问题 I'm trying to use mocha, request, and a SHA1 hash to write an integration test to confirm that the favicon being served from Express is the same as the one on the file system. I get two different hashes, and can't figure out why. Is it possible the encoding is changing? process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0" // Avoids DEPTH_ZERO_SELF_SIGNED_CERT error for self-signed certs var request = require("request"); var crypto = require('crypto'); var fs = require('fs'); var favicon = crypto

Work around lack of Yz machine constraint under Clang?

旧巷老猫 提交于 2019-12-23 10:10:52
问题 We use inline assembly to make SHA instructions available if __SHA__ is not defined. Under GCC we use: GCC_INLINE __m128i GCC_INLINE_ATTRIB MM_SHA256RNDS2_EPU32(__m128i a, const __m128i b, const __m128i c) { asm ("sha256rnds2 %2, %1, %0" : "+x"(a) : "xm"(b), "Yz" (c)); return a; } Clang does not consume GCC's Yz constraint (see Clang 3.2 Issue 13199 and Clang 3.9 Issue 32727), which is required by the sha256rnds2 instruction: Yz First SSE register (%xmm0). We added a mov for Clang: asm ("mov

Python implementation of sha512_crypt.c

ε祈祈猫儿з 提交于 2019-12-23 05:48:09
问题 I'm looking for a 100% pure Python implementation of sha512_crypt.c as taken from http://www.akkadia.org/drepper/SHA-crypt.txt. I'm learning Python. I want to understand the code (and compare it to the C code, etc.). I don't know enough Python to write it myself -- even if I did, I wouldn't trust myself to get it right. I don't have that expertise. So please don't answer this question by telling me to go write the code myself. That's not my question. I am looking for an existing 100% Python

SHA-256 Padding

随声附和 提交于 2019-12-22 12:17:09
问题 To calculate the SHA-256 hash I need to pad my message. Am using the following description: (taken from http://csrc.nist.gov/groups/STM/cavp/documents/shs/sha256-384-512.pdf) Pad the message in the usual way: Suppose the length of the message M, in bits, is l. Append the bit "1" to the end of the message, and then k zero bits, where k is the smallest non-negative solution to the equation l+1+k 448 mod 512. To this append the 64-bit block which is equal to the number l written in binary But

How to get SHA of file for specific Git commit?

浪子不回头ぞ 提交于 2019-12-22 07:41:36
问题 Is there a way to get SHA of file for specific Git commit? It's possible with 2 commands: retrieving file git show COMMIT_VERSION:myfile.txt > ~/tmp/myfile.txt calculating SHA git hash-object ./tmp/myfile.txt But, maybe there's specific command in Git that does exactly that? 回答1: git ls-tree COMMIT_VERSION myfile.txt appears to contain the same result in its third field. 来源: https://stackoverflow.com/questions/12017185/how-to-get-sha-of-file-for-specific-git-commit

How to get SHA of file for specific Git commit?

假装没事ソ 提交于 2019-12-22 07:41:05
问题 Is there a way to get SHA of file for specific Git commit? It's possible with 2 commands: retrieving file git show COMMIT_VERSION:myfile.txt > ~/tmp/myfile.txt calculating SHA git hash-object ./tmp/myfile.txt But, maybe there's specific command in Git that does exactly that? 回答1: git ls-tree COMMIT_VERSION myfile.txt appears to contain the same result in its third field. 来源: https://stackoverflow.com/questions/12017185/how-to-get-sha-of-file-for-specific-git-commit

How can I access SHA intrinsic?

落花浮王杯 提交于 2019-12-22 06:48:01
问题 Gprof tells me that my computationally heavy program spends most of it's time (36%) hashing using AP-Hash. I can't reduce the call count but I would still like to make it faster, can I call intrinsic SHA from a c program? Do I need the intel compiler or can I stick with gcc? 回答1: SHA instructions are now available in Goldmont architecture. It was released around September, 2016. According to the Intel Intrinsics Guide, these are the intrinsics of interest: __m128i _mm_sha1msg1_epu32 (__m128i

Changing the hashing function on a pre-existing database

亡梦爱人 提交于 2019-12-22 06:37:38
问题 I'm doing a bit of reading on hashing for passwords. I've seen that SHA-256 > MD5. This got me thinking about how an app may deal with changing from one hashing function to another. What happens if someone implements an app that hashes their passwords using MD5. They then decide that SHA-256 is the way to go. But of course the password hashes stored in the database are in MD5. What is the process for migrating the data in the database from one hashing function to another? 回答1: It is not

How long can a hash left out in the open be considered safe?

一曲冷凌霜 提交于 2019-12-21 05:04:20
问题 If I were to leave a SHA2 family hash out on my website - how long would it be considered safe? How long would I have before I could be sure that someone would find a collision for it and know what was hashed? I know that the amount of time would be based on the computational power of the one seeking to break it. It would also depend on the string length, but I'm curious just how secure hashes are. Since many of us run web-servers we constantly have to be prepared for the day when someone

Is it possible to decrypt SHA1 [duplicate]

筅森魡賤 提交于 2019-12-21 03:32:46
问题 This question already has answers here : Is it possible to reverse a sha1? (9 answers) Closed 5 years ago . Is it possible to decrypt(retain the actual string) the password which is saved in db using SHA1 algorithm. Example:If password is "password" and it is stored in db as "sha1$4fb4c$2bc693f8a86e2d87f757c382a32e3d50fc945b24" ,is any chance to retain the same "password"(string) from "sha1$4fb4c$2bc693f8a86e2d87f757c382a32e3d50fc945b24" 回答1: SHA1 is a cryptographic hash function, so the