Create SHA-256 hash from a Blob/File in javascript

You may want to take a look at the Stanford JS Crypto Library GitHub Website with Examples From the website: SJCL is secure. It uses the industry-standard AES algorithm at 128, 192 or 256 bits; the SHA256 hash function; the HMAC authentication code; the PBKDF2 password strengthener; and the CCM and OCB authenticated-encryption modes. SJCL … Read more

Why does Zipping the same content twice gives two files with different SHA1?

According to Wikipedia http://en.wikipedia.org/wiki/Zip_(file_format) seems that zip files have headers for File last modification time and File last modification date so any zip file checked into git will appear to git to have changed if the zip is rebuilt from the same content since. And it seems that there is no flag to tell it … Read more

Java: How to create SHA-1 for a file?

Use the MessageDigest class and supply data piece by piece. The example below ignores details like turning byte[] into string and closing the file, but should give you the general idea. public byte[] createSha1(File file) throws Exception { MessageDigest digest = MessageDigest.getInstance(“SHA-1”); InputStream fis = new FileInputStream(file); int n = 0; byte[] buffer = new … Read more

How to find a Github file ‘s SHA blob

The docs for updating a file specify that you will need to provide the SHA for the file you will be replacing. The easiest way would be to query github for that, too. For example: > curl https://api.github.com/repos/testacc01/testrepo01/contents/test.txt { “name”: “test.txt”, “path”: “test.txt”, “sha”: “4f8a0fd8ab3537b85a64dcffa1487f4196164d78”, “size”: 13, … So, you can see what the SHA … Read more

Does every Android phone support SHA-256

All Android devices support SHA-256. The NoSuchAlgorithmException indicates that a requested algorithm could not be found and is necessary because the method takes a String argument for the algorithm name. If you passed in “foo-256”, the method’s only recourse is to throw a NoSuchAlgorithmException because, for reasons beyond my understanding, there’s no algorithm called “foo-256”. … Read more

Why does git commit –amend change the hash even if I don’t make any changes?

Yes, it’s the commit timestamp. Inspecting the contents of the two commits reveals: $ git cat-file commit 82c7363bcfd727fe2d6b0a98412f71a10c8849c9 tree d87cbcba0e2ede0752bdafc5938da35546803ba5 author Thomas <xxx> 1400700200 +0200 committer Thomas <xxx> 1400700200 +0200 hello $ git cat-file commit 7432fcf82b65d9d757efd73ef7d6bff4707f99bd tree d87cbcba0e2ede0752bdafc5938da35546803ba5 author Thomas <xxx> 1400700200 +0200 committer Thomas <xxx> 1400700214 +0200 hello If you amended in the same … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)