sha

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

非 Y 不嫁゛ 提交于 2019-11-27 03:04:29
问题 Why does the SHA-1 hash of my latest commit change even if I don't make any changes to the commit (message, files) after running git commit --amend ? Say I run the following at the command line. cd ~/Desktop mkdir test_amend cd test_amend git init echo 'foo' > test.txt git add test.txt git commit -m 'initial commit' Then, invoking git log --pretty=oneline --abbrev-commit prints the following message: b96a901 initial commit I then do git commit --amend but I change my mind and decide not to

Suppress Firefox/Firebug SHA-1 warning

别说谁变了你拦得住时间么 提交于 2019-11-27 01:44:17
问题 I use Firebug for web development. Since version Firefox 37 I see the following annoying message in my console: This site makes use of a SHA-1 Certificate; it's recommended you use certificates with signature algorithms that use hash functions stronger than SHA-1" I understand that it is an important message, but it is duplicated many times and makes my work almost impossible. Moreover, it appears every time my page communicates with other pages, for example with Google Analytics and other

Improve password hashing with a random salt

回眸只為那壹抹淺笑 提交于 2019-11-27 01:35:11
I'm starting a website and I'm trying to decide how to encrypt user passwords to store them in a SQL database. I realize that using a simple md5(password) is very unsecured. I'm considering using a sha512(password.salt), and I have been researching the best way to generate a useful salt. I read numerous articles stating that a salt should be as random as possible to add entropy to the hash and it looks like a great idea. But: you need to store the random salt along with your hash given that an attacker somehow got access to your hashed passwords (and is trying to reverse the hash to plain text

SHA2 password hashing in java

强颜欢笑 提交于 2019-11-27 01:24:30
问题 I'm trying to hash some passwords with SHA2. Where can I get a snippet of java code for make that? I have seen that post but I have something missing: SHA2 password storage with Java Mac mac = Mac.getInstance("HmacSha256"); SecretKeySpec secret = new SecretKeySpec(key.getBytes(), "HmacSha256"); mac.init(secret); byte[] shaDigest = mac.doFinal(phrase.getBytes()); String hash = ""; for(byte b:shaDigest) { hash += String.format("%02x",b); } The phrase is the String I want encode right? And what

Creating user with encrypted password in PostgreSQL

こ雲淡風輕ζ 提交于 2019-11-27 00:41:58
问题 Is it possible to create a user in PostgreSQL without providing the plain text password (ideally, I would like to be able to create a user providing only its password crypted with sha-256) ? What I would like to do is to create a user with something like that : CREATE USER "martin" WITH PASSWORD '$6$kH3l2bj8iT$KKrTAKDF4OoE7w.oy(...)BPwcTBN/V42hqE.'; Is there some way to do that ? Thank you for your help. 回答1: You may provide the password already hashed with md5 , as said in the doc (CREATE

How long to brute force a salted SHA-512 hash? (salt provided)

天涯浪子 提交于 2019-11-26 23:47:28
Here is an algorithm in Java: public String getHash(String password, String salt) throws Exception { String input = password + salt; MessageDigest md = MessageDigest.getInstance(SHA-512); byte[] out = md.digest(input.getBytes()); return HexEncoder.toHex(out); } Assume the salt is known. I want to know the time to brute force for when the password is a dictionary word and also when it is not a dictionary word. emboss In your case, breaking the hash algorithm is equivalent to finding a collision in the hash algorithm. That means you don't need to find the password itself (which would be a

multiple send from server to client python

限于喜欢 提交于 2019-11-26 23:47:24
问题 First I am sending the requested file from the server to the client and after that I want to send the computed sha of the file from the server to the client, so that the client can check if both the sha from the sent and the received files are the same. I manage to send the file but when I try to also send the sha (which is a variable) I receive a error ( i believe that the sha is also added to the file content) How can i send them separately? if (reqCommand == 'get'): with open (reqFile, 'rb

I'm using MD5 to hash passwords. When should I jump to the next thing? SHA-3? [closed]

本秂侑毒 提交于 2019-11-26 23:34:00
问题 On the 2nd of October NIST decided that SHA-3 is the new standard hashing algorithm. Should MD5 users start migrating to SHA-3? To something else (see below why SHA-3 is not recommended)? bcrypt? Why Not {MD5, SHA1, SHA256, SHA512, SHA-3, etc}? And, is this really critical? Even if your password is salted? 回答1: The main reason not to use MD5 for hashing passwords is not the fact that MD5 is severely compromised or even considered broken. It’s true, MD5 has known vulnerabilities. But none of

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

最后都变了- 提交于 2019-11-26 22:50:11
问题 What is the best way to create a SHA-1 for a very large file in pure Java6? How to implement this method: public abstract String createSha1(java.io.File file); 回答1: 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

Is the SHA-1 of commits calculated based only on the content of the tree?

断了今生、忘了曾经 提交于 2019-11-26 22:23:41
问题 For the sake of an experiment, lets say your git log identifies the following commits commit 16bc8486fb34cf9a6faf0f7df606ae72ad9ea438 // added 2nd file commit 9188f9a25b045f130b08888bc3f638099fa7f212 // initial commit After committing, .git/refs/heads/master points to 16bc8486fb34cf9a6faf0f7df606ae72ad9ea438. Let's say, after this, i manually edit the .git/refs/heads/master file to point to 9188f9a25b045f130b08888bc3f638099fa7f212 At this point, git status recognizes that a new uncommitted