sha

Byte array in objective c with ascii encoding

安稳与你 提交于 2021-02-19 08:37:52
问题 I am trying to get a byte array from an NSString in objective c using ascii encoding. I need to this array to calculate the SHA256 hash of that string and then compare the result to the SHA256 encoding generated in Windows. NSString *myString = @"123456¥"; const char *string = (const unsigned char *) [myString cStringUsingEncoding:NSASCIIStringEncodin]; this always gives nil since it contains the ¥ character. the problem is I cannot use UTF8Encoding since the hash generated by windows uses

How secure is MD5 and SHA1

[亡魂溺海] 提交于 2021-02-18 11:15:08
问题 Hey just a simple questions, as im tryng to understand a bit more on Hash functions, I know how they work and what they do but how secure are they? I would appreciate a simple answer not links as I never find them useful. 回答1: With nowadays technology, both can be cracked. There are also hash dictionaries that help find what a hash means for short strings. If they are secure or not, highly depends on what you want to protect. If you are building an online banking system, they are not

SHA algorithm generates each time unique hash string for a same key

陌路散爱 提交于 2021-02-18 03:34:26
问题 I know there are lots lots of articles available about hashing and encryption algorithm. I have figure it out from them that use hashing function instead of encryption to store password in the database . So I decided to use SHA-256 algorithm to generate hash key and I am storing that hash key into my server database instead of plain password. Now I am really not able to understand how I should use it, because each time I am passing the same password to generate SHA key it gives me different

Take sha number of commit by tig

女生的网名这么多〃 提交于 2021-02-07 19:53:20
问题 I love to use tig client to navigate through git commits. But I'm missing one thing for now. Is there a key binding to take a sha number of a git commit I'm currently staying at? 回答1: Check if the command proposed in jonas/tig issue 557 would work for you: bind generic 9 !sh -c "echo -n %(commit) | xclip -selection c && echo Copied %(commit) to clipboard" That would copy the current commit SHA1 in your clipboard. In the Wiki binding page, you also have example for Mac or Cygwin: bind generic

Take sha number of commit by tig

廉价感情. 提交于 2021-02-07 19:48:27
问题 I love to use tig client to navigate through git commits. But I'm missing one thing for now. Is there a key binding to take a sha number of a git commit I'm currently staying at? 回答1: Check if the command proposed in jonas/tig issue 557 would work for you: bind generic 9 !sh -c "echo -n %(commit) | xclip -selection c && echo Copied %(commit) to clipboard" That would copy the current commit SHA1 in your clipboard. In the Wiki binding page, you also have example for Mac or Cygwin: bind generic

Probability of collision with truncated SHA-256 hash

耗尽温柔 提交于 2021-02-07 18:28:18
问题 I have a database-driven web application where the primary keys of all data rows are obfuscated as follows: SHA256(content type + primary key + secret), truncated to the first 8 characters. The content type is a simple word, e.g. "post" or "message" and the secret is a 20-30 char ASCII constant. The result is stored in a separate indexed column for fast DB lookup. How do I calculate the probability of a hash collision in this scenario? I am not a mathematician at all, but a friend claimed

PBKDF2WithHmacSHA256 impact of key length to the output length

懵懂的女人 提交于 2021-01-28 21:05:54
问题 Consider the following java code: KeySpec spec = new PBEKeySpec("pass".toCharArray(), "salt".getBytes(), 10000, 512); SecretKeyFactory f = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256"); System.out.println(f.generateSecret(spec).getEncoded().length); This code outputs " 64 ". So 64 bytes, while SHA-256 is a 32 byte hash. I know I specified 512 bits (64 byte) as the key length. However I would expect that the generated key (PBKDF2) will be hashed by SHA-256 so that the output should

Generate HMAC SHA256 signature Powershell

女生的网名这么多〃 提交于 2021-01-28 10:48:31
问题 For 3commas I tried to generate a HMAC SHA256 signature in Powershell with the example parameters from the documentation: $secret = 'NhqPtmdSJYdKjVHjA7PZj4Mge3R5YNiP1e3UZjInClVN65XAbvqqM6A7H5fATj0j' $message = '/public/api/ver1/accounts/new?type=binance&name=binance_account&api_key=XXXXXX&secret=YYYYYY' $hmacsha = New-Object System.Security.Cryptography.HMACSHA256 $hmacsha.key = [Text.Encoding]::ASCII.GetBytes($secret) $signature = $hmacsha.ComputeHash([Text.Encoding]::ASCII.GetBytes($message

Probability of hash collision

血红的双手。 提交于 2021-01-21 11:05:24
问题 I am looking for some precise math on the likelihood of collisions for MD5, SHA1, and SHA256 based on the birthday paradox. I am looking for something like a graph that says "If you have 10^8 keys, this is the probability. If you have 10^13 keys, this is the probability and so on" I have looked at tons of articles but I am having a tough time finding something that gives me this data. (Ideal option for me would be a formula or code that calculates this for any provided hash size) 回答1: Let's

Probability of hash collision

社会主义新天地 提交于 2021-01-21 11:05:23
问题 I am looking for some precise math on the likelihood of collisions for MD5, SHA1, and SHA256 based on the birthday paradox. I am looking for something like a graph that says "If you have 10^8 keys, this is the probability. If you have 10^13 keys, this is the probability and so on" I have looked at tons of articles but I am having a tough time finding something that gives me this data. (Ideal option for me would be a formula or code that calculates this for any provided hash size) 回答1: Let's