summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Chapman <matty@samba.org>1999-07-22 10:54:18 +0000
committerMatthew Chapman <matty@samba.org>1999-07-22 10:54:18 +0000
commit0091c7768dc37c22206b345b306441583204dcba (patch)
tree848bc0dbda9be14bc11e8d229a4df6ce034c63de
parent0108188ceb9d786822e41b5fa3ffcfd6164afdd8 (diff)
downloadsamba-0091c7768dc37c22206b345b306441583204dcba.tar.gz
samba-0091c7768dc37c22206b345b306441583204dcba.tar.bz2
samba-0091c7768dc37c22206b345b306441583204dcba.zip
BDC support.
Algorithm based on previous work of Jeremy's. (This used to be commit f0c71a804dc869a73eb6af6e0ac9f4fb64dd1f68)
-rw-r--r--source3/libsmb/smbdes.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/source3/libsmb/smbdes.c b/source3/libsmb/smbdes.c
index fa7d64cec8..ba214a2eb0 100644
--- a/source3/libsmb/smbdes.c
+++ b/source3/libsmb/smbdes.c
@@ -401,3 +401,16 @@ void SamOEMhash( unsigned char *data, unsigned char *key, int val)
data[ind] = data[ind] ^ s_box[t];
}
}
+
+void sam_pwd_hash(uint32 rid, const uchar *in, uchar *out, int forw)
+{
+ unsigned char s[14];
+
+ s[0] = s[4] = s[8] = s[12] = (unsigned char)(rid & 0xFF);
+ s[1] = s[5] = s[9] = s[13] = (unsigned char)((rid >> 8) & 0xFF);
+ s[2] = s[6] = s[10] = (unsigned char)((rid >> 16) & 0xFF);
+ s[3] = s[7] = s[11] = (unsigned char)((rid >> 24) & 0xFF);
+
+ smbhash(out, in, s, forw);
+ smbhash(out+8, in+8, s+7, forw);
+}