Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » [SOLVED] SHA1/MD5 encrypt example
[SOLVED] SHA1/MD5 encrypt example [message #21764] Thu, 04 June 2009 15:33 Go to next message
qwerty is currently offline  qwerty
Messages: 130
Registered: May 2006
Experienced Member
Hello,

please, how can I encrypt/decrypt some string using SHA1 or make a MD5 of chunk of some data?

thank you...

[Updated on: Fri, 05 June 2009 19:04]

Report message to a moderator

Re: SHA1/MD5 encrypt example [message #21774 is a reply to message #21764] Thu, 04 June 2009 19:53 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Neither SHA1 or MD5 is crypting - both are hashes.

To obtain these hashes is simple. Say you have n bytes starting at ptr:

Cout() << SHA1String(ptr, n);

prints its has in hex form. SHA1StringS variant adds '-' into string.

If you are interested in hash bytes only, use SHA1 (and provide 20 bytes buffer to store the result).

If you want to process e.g. some very big file that you do not want to store into memory, use Sha1Stream - send all bytes to it, then retrieve result with one of

	void   Finish(byte *hash20);
	String FinishString();
	String FinishStringS();


Mirek
[SOLVED] Re: SHA1/MD5 encrypt example [message #21795 is a reply to message #21774] Fri, 05 June 2009 10:28 Go to previous message
qwerty is currently offline  qwerty
Messages: 130
Registered: May 2006
Experienced Member
oh... thank you!

[Updated on: Fri, 05 June 2009 19:03]

Report message to a moderator

Previous Topic: LocalProcess in Core
Next Topic: Problem with DirectoryExists() in windows
Goto Forum:
  


Current Time: Mon Apr 29 12:09:50 CEST 2024

Total time taken to generate the page: 0.01840 seconds