Fix SHA1 hashing.
This commit is contained in:
parent
bce9718b36
commit
c7ff6083f9
@ -17,11 +17,9 @@ you didn't get a copy, you may request one from <license@inner.net>.
|
||||
*/
|
||||
|
||||
#include "opie_cfg.h"
|
||||
#if 0
|
||||
#include "sha.h"
|
||||
#endif /* 0 */
|
||||
#include "opie.h"
|
||||
|
||||
#include <sha.h>
|
||||
#include <md4.h>
|
||||
#include <md5.h>
|
||||
|
||||
@ -30,18 +28,17 @@ VOIDRET opiehash FUNCTION((x, algorithm), VOIDPTR x AND unsigned algorithm)
|
||||
UINT4 *results = (UINT4 *)x;
|
||||
|
||||
switch(algorithm) {
|
||||
#if 0
|
||||
case 3:
|
||||
{
|
||||
SHA_CTX sha;
|
||||
SHAInit(&sha);
|
||||
SHAUpdate(&sha, (unsigned char *)x, 8);
|
||||
SHAFinal(&sha);
|
||||
results[0] = sha.buffer[0] ^ sha.buffer[2] ^ sha.buffer[4];
|
||||
results[1] = sha.buffer[1] ^ sha.buffer[3];
|
||||
UINT4 digest[5];
|
||||
SHA1_Init(&sha);
|
||||
SHA1_Update(&sha, (unsigned char *)x, 8);
|
||||
SHA1_Final((unsigned char *)digest, &sha);
|
||||
results[0] = digest[0] ^ digest[2] ^ digest[4];
|
||||
results[1] = digest[1] ^ digest[3];
|
||||
};
|
||||
break;
|
||||
#endif /* 0 */
|
||||
case 4:
|
||||
{
|
||||
MD4_CTX mdx;
|
||||
|
@ -16,6 +16,7 @@ you didn't get a copy, you may request one from <license@inner.net>.
|
||||
#include "opie_cfg.h"
|
||||
#include "opie.h"
|
||||
|
||||
#include <sha.h>
|
||||
#include <md4.h>
|
||||
#include <md5.h>
|
||||
|
||||
@ -23,20 +24,18 @@ VOIDRET opiehashlen FUNCTION((algorithm, in, out, n), int algorithm AND VOIDPTR
|
||||
{
|
||||
UINT4 *results = (UINT4 *)out;
|
||||
UINT4 mdx_tmp[4];
|
||||
#if 0
|
||||
SHA_INFO sha;
|
||||
#endif /* 0 */
|
||||
|
||||
switch(algorithm) {
|
||||
#if 0
|
||||
case 3:
|
||||
sha_init(&sha);
|
||||
sha_update(&sha, (BYTE *)in, n);
|
||||
sha_final(&sha);
|
||||
results[0] = sha.digest[0] ^ sha.digest[2] ^ sha.digest[4];
|
||||
results[1] = sha.digest[1] ^ sha.digest[3] ^ sha.digest[5];
|
||||
case 3: {
|
||||
SHA_CTX sha;
|
||||
UINT4 digest[5];
|
||||
SHA1_Init(&sha);
|
||||
SHA1_Update(&sha, (unsigned char *)in, n);
|
||||
SHA1_Final((unsigned char *)digest, &sha);
|
||||
results[0] = digest[0] ^ digest[2] ^ digest[4];
|
||||
results[1] = digest[1] ^ digest[3];
|
||||
break;
|
||||
#endif /* 0 */
|
||||
}
|
||||
case 4: {
|
||||
MD4_CTX mdx;
|
||||
MD4Init(&mdx);
|
||||
|
Loading…
Reference in New Issue
Block a user