Update md5.h
Convert multi line comments into single line comments, fix spacing, fix verbosity, fix some typos, add capitals
This commit is contained in:
parent
e630f1248e
commit
2b94002489
|
@ -1,23 +1,23 @@
|
||||||
// MD5.CC - source code for the C++/object oriented translation and
|
/*
|
||||||
// modification of MD5.
|
|
||||||
|
|
||||||
// Translation and modification (c) 1995 by Mordechai T. Abzug
|
MD5.CC - source code for the C++/object oriented translation and modification of MD5.
|
||||||
|
|
||||||
// This translation/ modification is provided "as is," without express or
|
Translation and modification (c) 1995 by Mordechai T. Abzug
|
||||||
// implied warranty of any kind.
|
|
||||||
|
|
||||||
// The translator/ modifier does not claim (1) that MD5 will do what you think
|
This translation/ modification is provided "as is," without express or
|
||||||
// it does; (2) that this translation/ modification is accurate; or (3) that
|
implied warranty of any kind.
|
||||||
// this software is "merchantible." (Language for this disclaimer partially
|
|
||||||
// copied from the disclaimer below).
|
|
||||||
|
|
||||||
/* based on:
|
The translator/ modifier does not claim (1) that MD5 will do what you think
|
||||||
|
it does; (2) that this translation/ modification is accurate; or (3) that
|
||||||
|
this software is "merchantable." (Language for this disclaimer partially
|
||||||
|
copied from the disclaimer below).
|
||||||
|
|
||||||
|
based on:
|
||||||
|
|
||||||
MD5.H - header file for MD5C.C
|
MD5.H - header file for MD5C.C
|
||||||
MDDRIVER.C - test driver for MD2, MD4 and MD5
|
MDDRIVER.C - test driver for MD2, MD4 and MD5
|
||||||
|
|
||||||
Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
|
Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All rights reserved.
|
||||||
rights reserved.
|
|
||||||
|
|
||||||
License to copy and use this software is granted provided that it
|
License to copy and use this software is granted provided that it
|
||||||
is identified as the "RSA Data Security, Inc. MD5 Message-Digest
|
is identified as the "RSA Data Security, Inc. MD5 Message-Digest
|
||||||
|
@ -89,45 +89,43 @@ struct MD5Digest_less : std::binary_function < MD5Digest, MD5Digest, bool >
|
||||||
class MD5
|
class MD5
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// methods for controlled operation:
|
// Methods for controlled operation:
|
||||||
MD5(); // simple initializer
|
MD5(); // Simple initializer
|
||||||
~MD5();
|
~MD5();
|
||||||
void update(const unsigned char *input, unsigned int input_length);
|
void update(const unsigned char *input, unsigned int input_length);
|
||||||
void update(FILE *file);
|
void update(FILE *file);
|
||||||
void finalize();
|
void finalize();
|
||||||
|
|
||||||
// constructors for special circumstances. All these constructors finalize
|
// Constructors for special circumstances. All these constructors finalize the MD5 context.
|
||||||
// the MD5 context.
|
MD5(CPath File); // Digest file, finalize
|
||||||
MD5(CPath File); // digest File, finalize
|
MD5(const unsigned char *string); // Digest string, finalize
|
||||||
MD5(const unsigned char *string); // digest string, finalize
|
MD5(FILE *file); // Digest file, close, finalize
|
||||||
MD5(FILE *file); // digest file, close, finalize
|
|
||||||
MD5(const unsigned char *input, unsigned int input_length);
|
MD5(const unsigned char *input, unsigned int input_length);
|
||||||
MD5(const stdstr & string);
|
MD5(const stdstr & string);
|
||||||
|
|
||||||
// methods to acquire finalized result
|
// Methods to acquire finalized result
|
||||||
void get_digest(MD5Digest& extdigest); //Digest into a digest structure
|
void get_digest(MD5Digest& extdigest); // Digest into a digest structure
|
||||||
const unsigned char *raw_digest(); // digest as a 16-byte binary array
|
const unsigned char *raw_digest(); // Digest as a 16-byte binary array
|
||||||
const char * hex_digest(); // digest as a 33-byte ascii-hex string
|
const char * hex_digest(); // Digest as a 33-byte ascii-hex string
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// first, some types:
|
// First, some types:
|
||||||
typedef unsigned int uint4; // assumes integer is 4 words long
|
typedef unsigned int uint4; // Assumes integer is 4 words long
|
||||||
typedef unsigned short int uint2; // assumes short integer is 2 words long
|
typedef unsigned short int uint2; // Assumes short integer is 2 words long
|
||||||
typedef unsigned char uint1; // assumes char is 1 word long
|
typedef unsigned char uint1; // Assumes char is 1 word long
|
||||||
|
|
||||||
// next, the private data:
|
// Next, the private data:
|
||||||
uint4 state[4];
|
uint4 state[4];
|
||||||
uint4 count[2]; // number of *bits*, mod 2^64
|
uint4 count[2]; // Number of *bits*, mod 2^64
|
||||||
uint1 buffer[64]; // input buffer
|
uint1 buffer[64]; // Input buffer
|
||||||
uint1 digest[16];
|
uint1 digest[16];
|
||||||
uint1 finalized;
|
uint1 finalized;
|
||||||
stdstr m_hex_digest;
|
stdstr m_hex_digest;
|
||||||
|
|
||||||
// last, the private methods, mostly static:
|
// Last, the private methods, mostly static:
|
||||||
void init(); // called by all constructors
|
void init(); // Called by all constructors
|
||||||
void transform(uint1 *buffer); // does the real update work. Note
|
void transform(uint1 *buffer); // Does the real update work. Note that length is implied to be 64.
|
||||||
// that length is implied to be 64.
|
|
||||||
|
|
||||||
static void encode(uint1 *dest, uint4 *src, uint4 length);
|
static void encode(uint1 *dest, uint4 *src, uint4 length);
|
||||||
static void decode(uint4 *dest, uint1 *src, uint4 length);
|
static void decode(uint4 *dest, uint1 *src, uint4 length);
|
||||||
|
|
Loading…
Reference in New Issue