Information Security/Information.Security

SHA (Secure Hash Algorithm)

petitCoding 2012. 4. 16. 14:40

SHA (Secure Hash Algorithm)

 

SHA is developed in USA, When it's started, there's only SHA-0 exsited.

Now SHA-256, SHA-224 and SHA-1 is added.

SHE-1 is the most famous hash algorithm. 

SHA algorithm is used to check integrity of critical data. 

MD5 is also sort of hash algorithm.

And this hash function can be used for password which shouldn't decrypt.

In openssl, we can see this SHA algorithm, and use like this;

 

 

unsigned char *SHA(const unsigned char *d, size_t n, unsigned char *md);

 

or

 

int SHA_Init(SHA_CTX *c);
int SHA_Update(SHA_CTX *c, const void *data, size_t len);
int SHA_Final(unsigned char *md, SHA_CTX *c);

 

 

 

It is simple password program using hash function (in openssl).

- include sha.h (openssl source file)

- Use libcrypto.so library

- Openssl Version 1.0.0

 

#include <openssl/sha.h>

char *passwd, *out;

passwd = malloc(128);

out = malloc(32);

printf("input your PW : ");
scanf("%s", passwd);

SHA256(passwd, strlen(passwd), out);

 

> gcc -o test test.c -lcrypto

 

To get more detail,  

CLICK HERE

 

반응형

'Information Security > Information.Security' 카테고리의 다른 글

VoIP attack  (0) 2012.05.24
RADIUS(Remote Authentication Dial In User Service)  (0) 2012.05.24
Install Asterisk with TLS  (1) 2012.04.16
Openssl- How to set the ciphers?  (0) 2012.04.16
Openssl  (0) 2012.04.16