X-Git-Url: https://git.hcoop.net/hcoop/debian/courier-authlib.git/blobdiff_plain/8d138742ae268344f406cb75d79aa6bf853f9d87:/sha1/sha512_hash.c..refs/tags/upstream/0.66.1:/libs/sha1/static/static/gitweb.js diff --git a/sha1/sha512_hash.c b/sha1/sha512_hash.c deleted file mode 100644 index 0cb0e65..0000000 --- a/sha1/sha512_hash.c +++ /dev/null @@ -1,46 +0,0 @@ -/* -** Copyright 2008 Double Precision, Inc. -** See COPYING for distribution information. -*/ - -#include "sha1.h" -#include - -static const char rcsid[]="$Id: sha512_hash.c,v 1.1 2008/12/25 14:39:11 mrsam Exp $"; - -static const char base64tab[]= -"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - -const char *sha512_hash(const char *passw) -{ -SHA512_DIGEST sha512buf; -static char hash_buffer[1+(sizeof(sha512buf)+2)/3*4]; -int a=0,b=0,c=0; -int i, j; -int d, e, f, g; - - sha512_digest(passw, strlen(passw), sha512buf); - - j=0; - - for (i=0; i> 2 ]; - e=base64tab[ ((a & 3 ) << 4) | (b >> 4)]; - f=base64tab[ ((b & 15) << 2) | (c >> 6)]; - g=base64tab[ c & 63 ]; - if (i + 1 >= sizeof(sha512buf)) f='='; - if (i + 2 >= sizeof(sha512buf)) g='='; - hash_buffer[j++]=d; - hash_buffer[j++]=e; - hash_buffer[j++]=f; - hash_buffer[j++]=g; - } - - hash_buffer[j]=0; - return (hash_buffer); -}