C Board  

Go Back   C Board > General Programming Boards > C Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 09-13-2005, 11:35 PM   #1
Shibby
 
willc0de4food's Avatar
 
Join Date: Mar 2005
Location: MI
Posts: 376
How do i un-SHA1 hash something..

hey, i'm using CryptoSys API for encryption, and i got a program to successfully encrypt using the SHA1 algorithm....but how do i un-SHA1 the information? lol

thanks
__________________
http://willc0de4food.is-a-geek.com <- visit me :]
Registered Linux User #380033. Be counted: http://counter.li.org
willc0de4food is offline   Reply With Quote
Old 09-13-2005, 11:43 PM   #2
Registered User
 
Tonto's Avatar
 
Join Date: Jun 2005
Location: New York
Posts: 1,465
define:hash

- A mathematical formula that converts a message of any length into a unique fixed-length string of digits (typically 160 bits) known as "message digest" that represents the original message. A hash is a one-way function - that is, it is infeasible to reverse the process to determine the original message. Also, a hash function will not produce the same message digest from two different inputs.

- A one-way algorithm which maps or translates one set of bits into another (generally smaller) in such a way that the algorithm yields the same hash results every time for the same message, and it is computationally infeasible for a message to be reconstituted from the hash result. Also, two different messages cannot produce the same hash results.

You can't! You don't! If you want to be able to recover your plaintext, use an encryption algorithm, not a hashing algorithm.
Tonto is offline   Reply With Quote
Old 09-13-2005, 11:59 PM   #3
Shibby
 
willc0de4food's Avatar
 
Join Date: Mar 2005
Location: MI
Posts: 376
hahah.

good point... :-[

liiiiike..?

mm..however much names of encryption algorithms help...they dont, tutorials / source help. thanks!


mm..in case it matters: OS - Windows XP Pro SP2
Dev-C++ 4.9.9.2
__________________
http://willc0de4food.is-a-geek.com <- visit me :]
Registered Linux User #380033. Be counted: http://counter.li.org
willc0de4food is offline   Reply With Quote
Old 09-14-2005, 12:05 AM   #4
cwr
Registered Luser
 
cwr's Avatar
 
Join Date: Jul 2005
Location: Singapore
Posts: 867
AES?
cwr is offline   Reply With Quote
Old 09-14-2005, 05:59 AM   #5
Shibby
 
willc0de4food's Avatar
 
Join Date: Mar 2005
Location: MI
Posts: 376
hMm....not to be a [Shift]+244, but..
Quote:
mm..however much names of encryption algorithms help...they dont, tutorials / source help. thanks!

i know OF encryption methods such as AES, its predecessor DES, blowfish.....but i dont know how to use them. i even have the prototypes defined in the diCryptoSys.h header file..
Code:
/* AES-256 PROTOTYPES */
long _stdcall AES256_Bytes(unsigned char *output, const unsigned char *input,
	long nbytes, const unsigned char *key, int bEncrypt); 
long _stdcall AES256_BytesMode(unsigned char *output, const unsigned char *input,
	long nbytes, const unsigned char *key, int bEncrypt, 
	const char *lpszMode, const unsigned char *iv);
long _stdcall AES256_Hex(char *lpszOutput, const char *lpszInput,
	const char *lpszKey, int bEncrypt);
long _stdcall AES256_HexMode(char *lpszOutput, const char *lpszInput,
	const char *lpszKey, int bEncrypt, const char *lpszMode, const char *lpszIV);
long _stdcall AES256_File(const char *lpszFileOut, const char *lpszFileIn,
	const unsigned char *key, int bEncrypt, const char *lpszMode, const unsigned char *iv);
long _stdcall AES256_FileHex(const char *lpszFileOut, const char *lpszFileIn,
	const char *lpszKey, int bEncrypt, const char *lpszMode, const char *lpszIV);
long _stdcall AES256_Init(const unsigned char *key,  
	int bEncrypt, const char *lpszMode, const unsigned char *iv);
long _stdcall AES256_InitHex(const char *lpszKey, int bEncrypt, 
						   const char *lpszMode, const char *lpszIV);
long _stdcall AES256_Update(long ctx_handle, unsigned char *data, long dataLen);
long _stdcall AES256_UpdateHex(long ctx_handle, char *lpszHex);
long _stdcall AES256_Final(long ctx_handle);
long _stdcall AES256_InitError(void);

/* BLOWFISH PROTOTYPES */
long _stdcall BLF_Hex(char *sOutput, const char *sInput,
	const char *sKey, int bEncrypt);
long _stdcall BLF_HexMode(char *sOutput, const char *sInput,
	const char *sHexKey, int bEncrypt, const char *sMode, const char *sHexIV);
long _stdcall BLF_Bytes(unsigned char *output, const unsigned char *input,
	long nbytes, const unsigned char *key, long keyBytes, int bEncrypt);
long _stdcall BLF_BytesMode(unsigned char *output, const unsigned char *input,
	long nbytes, const unsigned char *key, long keyBytes, 
	int bEncrypt, const char *sMode, const unsigned char *iv);
long _stdcall BLF_File(const char *sFileOut, const char *sFileIn,
	const unsigned char *key, long keyBytes, int bEncrypt,
	const char *sMode, const unsigned char *iv);
long _stdcall BLF_FileHex(const char *sFileOut, const char *sFileIn,
	const char *sHexKey, int bEncrypt, const char *sMode, const char *sHexIV);
long _stdcall BLF_Init(const unsigned char *key, 
	long keyBytes, int bEncrypt,
	const char *sMode, const unsigned char *iv);
long _stdcall BLF_InitHex(const char *sHexKey, int bEncrypt,
	const char *sMode, const char *sHexIV);
long _stdcall BLF_UpdateHex(long ctx_handle, char *sHexData);
long _stdcall BLF_Update(long ctx_handle, unsigned char *data,
						   long dataLen);
long _stdcall BLF_Final(long ctx_handle);
long _stdcall BLF_Ecb(long ctx_handle, unsigned char *data,
						   long dataLen, int bEncrypt);
long _stdcall BLF_EcbHex(long ctx_handle, char *sHexBlock, int bEncrypt);
long _stdcall BLF_InitError(void);
and i could take a stab at implementing them, but i'd prly be wrong. lol
thanks tho

also..for SHA1 i had declared char digest[41]; to hold the hashed string..if i were going to use SHA-256..whats size of an array would i have to declare? char digest[64]?
thanks^3, lol
__________________
http://willc0de4food.is-a-geek.com <- visit me :]
Registered Linux User #380033. Be counted: http://counter.li.org

Last edited by willc0de4food; 09-14-2005 at 06:36 AM.
willc0de4food is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with unaligned intrinsics The Wazaa C++ Programming 4 02-18-2009 12:36 PM
Bernstein hash? audinue C Programming 0 01-07-2009 07:24 AM
need help with hash tables with direct chaining agentsmith C Programming 4 01-05-2008 04:19 AM
Group Project Help/Volunteer DarkDot C++ Programming 3 04-24-2007 11:36 PM
Not sure on hash table memory allocations Thumper333 C Programming 3 09-27-2004 09:00 PM


All times are GMT -6. The time now is 01:23 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22