Skip to main content
  • Home
  • login
  • Browse the archive

    swh mirror partner logo
swh logo
SoftwareHeritage
Software
Heritage
Mirror
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

  • 7fb1b40
  • /
  • sha.doc
Raw File
Permalinks

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
content badge Iframe embedding
swh:1:cnt:895fa182ed90f8e47f86957aa11b268f236458cb
directory badge Iframe embedding
swh:1:dir:7fb1b40fac800276b83cf2e67cdda4b7cd930197
sha.doc
The SHA (Secure Hash Algorithm) library.
SHA is a message digest algorithm that can be used to condense an arbitrary
length message down to a 20 byte hash.  The functions all need to be passed
a SHA_CTX which is used to hold the SHA context during multiple SHA_Update()
function calls.  The normal method of use for this library is as follows
This library contains both SHA and SHA-1 digest algorithms.  SHA-1 is
an update to SHA (which should really be called SHA-0 now) which
tweaks the algorithm slightly.  The SHA-1 algorithm is used by simply
using SHA1_Init(), SHA1_Update(), SHA1_Final() and SHA1() instead of the
SHA*() calls

SHA_Init(...);
SHA_Update(...);
...
SHA_Update(...);
SHA_Final(...);

This library requires the inclusion of 'sha.h'.

The functions are as follows:

void SHA_Init(
SHA_CTX *c);
	This function needs to be called to initiate a SHA_CTX structure for
	use.
	
void SHA_Update(
SHA_CTX *c;
unsigned char *data;
unsigned long len);
	This updates the message digest context being generated with 'len'
	bytes from the 'data' pointer.  The number of bytes can be any
	length.

void SHA_Final(
unsigned char *md;
SHA_CTX *c;
	This function is called when a message digest of the data digested
	with SHA_Update() is wanted.  The message digest is put in the 'md'
	array and is SHA_DIGEST_LENGTH (20) bytes long.

unsigned char *SHA(
unsigned char *d;
unsigned long n;
unsigned char *md;
	This function performs a SHA_Init(), followed by a SHA_Update()
	followed by a SHA_Final() (using a local SHA_CTX).
	The resulting digest is put into 'md' if it is not NULL.
	Regardless of the value of 'md', the message
	digest is returned from the function.  If 'md' was NULL, the message
	digest returned is being stored in a static structure.
	

ENEA — Copyright (C), ENEA. License: GNU AGPLv3+.
Legal notes  ::  JavaScript license information ::  Web API

back to top