sha1

SHA1 vs md5 vs SHA256: which to use for a PHP login?

a 夏天 提交于 2019-11-26 14:03:25
I'm making a php login, and I'm trying to decide whether to use SHA1 or Md5, or SHA256 which I read about in another stackoverflow article. Are any of them more secure than others? For SHA1/256, do I still use a salt? Also, is this a secure way to store the password as a hash in mysql? function createSalt() { $string = md5(uniqid(rand(), true)); return substr($string, 0, 3); } $salt = createSalt(); $hash = sha1($salt . $hash); Johannes Gorset Neither. You should use bcrypt . The hashes you mention are all optimized to be quick and easy on hardware, and so cracking them share the same qualities

Android SHA1 release keystore not working with Google Maps

空扰寡人 提交于 2019-11-26 13:09:33
问题 I am using the Google Maps Android API and I\'m running into some issues. I am signing my apk with android studio (created one at .android/keystore.jks). Also I\'m selecting \"release\" as type in it. I have used the command keytool -list -v -keystore C:\\Users\\Toshiba\\.android\\keystore.jks to get the SHA1 fingerprint out of the keystore. The SHA1 is correct, but the Map is not shown on a signed APK. It is shown in a debug APK. Using keytool with the release keystore (keystore.jks) will

C# SHA-1 vs. PHP SHA-1…Different Results?

烈酒焚心 提交于 2019-11-26 12:42:15
问题 I am trying to calculate a SHA-1 Hash from a string, but when I calculate the string using php\'s sha1 function I get something different than when I try it in C#. I need C# to calculate the same string as PHP (since the string from php is calculated by a 3rd party that I cannot modify). How can I get C# to generate the same hash as PHP? Thanks!!! String = s934kladfklada@a.com C# Code (Generates d32954053ee93985f5c3ca2583145668bb7ade86) string encode = secretkey + email; UnicodeEncoding UE =

How do I create a SHA1 hash in ruby?

半腔热情 提交于 2019-11-26 11:52:57
问题 SHA Hash functions 回答1: require 'digest/sha1' Digest::SHA1.hexdigest 'foo' 回答2: For a Base64 encoded hash, to validated an Oauth signature, I used require 'base64' require 'hmac-sha1' Base64.encode64((HMAC::SHA1.new('key') << 'base').digest).strip 回答3: I created a helper gem which is a simple wrapper around some sha1 code require 'rickshaw' > Rickshaw::SHA1.hash('LICENSE.txt') => "4659d94e7082a65ca39e7b6725094f08a413250a" > "hello world".to_sha1 => "2aae6c35c94fcfb415dbe95f408b9ce91ee846ed"

Java String to SHA1

折月煮酒 提交于 2019-11-26 11:37:36
I'm trying to make a simple String to SHA1 converter in Java and this is what I've got... public static String toSHA1(byte[] convertme) { MessageDigest md = null; try { md = MessageDigest.getInstance("SHA-1"); } catch(NoSuchAlgorithmException e) { e.printStackTrace(); } return new String(md.digest(convertme)); } When I pass it toSHA1("password".getBytes()) , I get [�a�ɹ??�%l�3~��. I know it's probably a simple encoding fix like UTF-8, but could someone tell me what I should do to get what I want which is 5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8 ? Or am I doing this completely wrong? Nishant

Java calculate hex representation of a SHA-1 digest of a String

…衆ロ難τιáo~ 提交于 2019-11-26 09:37:04
问题 I\'m storing the user password on the db as a sha1 hash. Unfortunately I\'m getting strange answers. I\'m storing the string as this: MessageDigest cript = MessageDigest.getInstance(\"SHA-1\"); cript.reset(); cript.update(userPass.getBytes(\"utf8\")); this.password = new String(cript.digest()); I wanted something like this --> aff --> \"0c05aa56405c447e6678b7f3127febde5c3a9238\" rather than aff --> �V@\\D~fx����:�8 回答1: This is happening because cript.digest() returns a byte array, which you

How do you verify an RSA SHA1 signature in Python?

落花浮王杯 提交于 2019-11-26 09:21:30
问题 I\'ve got a string, a signature, and a public key, and I want to verify the signature on the string. The key looks like this: -----BEGIN PUBLIC KEY----- MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDfG4IuFO2h/LdDNmonwGNw5srW nUEWzoBrPRF1NM8LqpOMD45FAPtZ1NmPtHGo0BAS1UsyJEGXx0NPJ8Gw1z+huLrl XnAVX5B4ec6cJfKKmpL/l94WhP2v8F3OGWrnaEX1mLMoxe124Pcfamt0SPCGkeal VvXw13PLINE/YptjkQIDAQAB -----END PUBLIC KEY----- I\'ve been reading the pycrypto docs for a while, but I can\'t figure out how to make an RSAobj

How does the newly found SHA-1 collision affect Git?

耗尽温柔 提交于 2019-11-26 08:58:26
Recently a team of researchers generated two files with the same SHA-1 hash ( https://shattered.it/ ). Since Git uses this hash for its internal storage, how far does this kind of attack influence Git? Edit, late December 2017: Git version 2.16 is gradually acquiring internal interfaces to allow for different hashes . There is a long way to go yet. The short (but unsatisfying) answer is that the example files are not a problem for Git—but two other (carefully calculated) files could be. I downloaded both of these files, shattered-1.pdf and shattered-2.pdf , and put them into a new empty

Is calculating an MD5 hash less CPU intensive than SHA family functions?

删除回忆录丶 提交于 2019-11-26 08:15:01
问题 Is calculating an MD5 hash less CPU intensive than SHA-1 or SHA-2 on \"standard\" laptop x86 hardware? I\'m interested in general information, not specific to a certain chip. UPDATE: In my case, I\'m interested in calculating the hash of a file. If file-size matters, let\'s assume its 300K. 回答1: Yes, MD5 is somewhat less CPU-intensive. On my Intel x86 (Core2 Quad Q6600, 2.4 GHz, using one core), I get this in 32-bit mode: MD5 411 SHA-1 218 SHA-256 118 SHA-512 46 and this in 64-bit mode: MD5

Hash collision in git

偶尔善良 提交于 2019-11-26 07:58:46
问题 What would actually happen if I had a hash collision while using git? E.g. I manage to commit two files with the same sha1 checksum, would git notice it or corrupt one of the files? Could git be improved to live with that, or would I have to change to a new hash algorithm? (Please do not deflect this question by discussing how unlikely that is - Thanks) 回答1: Picking atoms on 10 Moons An SHA-1 hash is a 40 hex character string... that's 4 bits per character times 40... 160 bits. Now we know 10