- StackOverflow İlgili Sorular
- How to convert a raw 64-byte binary to Hex or ASCII in C
I´m using SHA512 in C to get an Hash-Value. I did it like this:

`#include <stdlib.h>#include <stdio.h>#include <openssl/sha.h>int main(int argc, char *argv[]){ unsigned char hash[SHA512_DIGEST_LENGTH]; char data[] = "data to hash"; //Test Data SHA512(data, sizeof(data) - 1, hash); //Kill termination character //Now there is the 64byte binary in hash`

I tried to convert it to hex by:

`long int binaryval, hexadecimalval = 0, i = 1, remainder;binaryval=(long int)hash; while (binaryval != 0) { remainder = binaryval % 10; hexadecimalval = hexadecimalval + remainder * i; i = i * 2; binaryval = binaryval / 10; } printf("Outpunt in Hex is: %lX \n", hexadecimalval); printf("%d\n",(long int) awhash ); return 0; }`

But this is not wat i wantet.

How can i convert the binary which is in a unsigned char into a human readable format? Best case in a char[] for printing.

The Hash for "data to hash" should be:

d98f945fee6c9055592fa8f398953b3b7cf33a47cfc505667cbca1adb344ff18a4f442758810186fb480da89bc9dfa3328093db34bd9e4e4c394aec083e1773a

- Verifying a digital signature in Ruby
I have a piece of data [ 'payload' ] which is Base64 encoded. Then i have a 'signature' which contains the payload's signature. I have a public key. The signature algorithm is SHA512withRSA.

How can I validate the digitally signed data ? I know the stesp should be as follows, but need help with the working code in ruby -

Apply verification, which means applying the public key to the signature (with given algorithm) and comparing the result with payload

- is SHA-512 collision resistant?
According to the books that i have read, it says that S.H.A(Secure Hash Algorithm) is collision resistant.But if the input space is a 1024 bit number and the output space is a 512 bit message digest then shouldn't it be colliding for (2^1024)/(2^512) times? As the range is lesser than the domain being mapped there should have been collisions. please explain where i am going wrong.

- C version of OpenSSL EVP_BytesToKey method
I'm looking for C implementation of the OpenSSL

`EVP_BytesToKey`

function.This is pseudo-code explanation of the EVP_BytesToKey method (in /doc/ssleay.txt of the OpenSSL source):

`/* M[] is an array of message digests * MD() is the message digest function */M[0]=MD(data . salt);for (i=1; i<count; i++) M[0]=MD(M[0]);i=1while (data still needed for key and iv){ M[i]=MD(M[i-1] . data . salt); for (i=1; i<count; i++) M[i]=MD(M[i]); i++;}If the salt is NULL, it is not used.The digests are concatenated together.M = M[0] . M[1] . M[2] .......`

this is my code(MD() is sha512. And i need the key is 32 bytes and the iv is 16 bytes)：

`int main(){ unsigned long long out[8]; unsigned char key[9] = {0x4b,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c}; int len, i; len = sizeof(key); sha512(out, key, len); unsigned char a[sizeof(out)]; for (i = 0; i < count; i++) { long2char(out, a); // unsigned long long to unsigned char; sha512(out, a, sizeof(out)); } return 0;}`

After

`count`

times`sha512()`

, the out is 64 bytes, so I think I don't need the rest of that pseudo-code. But the result is not correct， I don't know what went wrong.I wish you can help me to figure it out. thanks!

- Excel formula-based function for SHA256 / SHA512 hashing without VBA or macros
It's the year 2017 and anybody who needs to use hashes should avoid 'broken' ones such as MD5, if security is important. Has anybody found or created a way to do more secure SHA256 or SHA512 hashing in Excel, without using VBA or macros?

A spectacular example of this being done before was over 3½ years ago with MD5 (as seen in this SO: MD5 Hash function in excel without using VBA).

Reason for avoiding VBA/Macros: Compatibility with mobile devices, such as Excel for iOS.

Side Note: The original Stack Overflow post has a successful answer with a dead link, here is a new link for reference: https://tzamtzis.gr/2017/web-analytics/excel-function-md5-hashing-without-vba/

Ev - Site haritası - Gizlilik - Bağlantılar - Copyright © 2017 Cortex IT Ltd : Temas : admin @ cortexit.co.uk

Please note that by viewing our site you agree to our use of cookies (see Gizlilik for details). You will only see this message once.