diff options
author | Jeremy Allison <jra@samba.org> | 1998-03-18 19:07:53 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 1998-03-18 19:07:53 +0000 |
commit | da050244c305c1e03e2f3fb2ac02f6bc93ad47ca (patch) | |
tree | e6da7d243fd00f8fd4e9ade3fbbc191dfdd39cec /source3/libsmb | |
parent | 002176a37597b51b4f5e482d9c5e6a8f6b39257f (diff) | |
download | samba-da050244c305c1e03e2f3fb2ac02f6bc93ad47ca.tar.gz samba-da050244c305c1e03e2f3fb2ac02f6bc93ad47ca.tar.bz2 samba-da050244c305c1e03e2f3fb2ac02f6bc93ad47ca.zip |
Added SamOEMChangePassword functionality.
Jeremy.
(This used to be commit e02e3bcbbd4333113dde7bef47763fb229148007)
Diffstat (limited to 'source3/libsmb')
-rw-r--r-- | source3/libsmb/smbdes.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/source3/libsmb/smbdes.c b/source3/libsmb/smbdes.c index c345d051bd..8f95a5a297 100644 --- a/source3/libsmb/smbdes.c +++ b/source3/libsmb/smbdes.c @@ -341,3 +341,43 @@ void cred_hash2(unsigned char *out,unsigned char *in,unsigned char *key) smbhash(out, buf, key2, 1); } +void SamOEMhash( unsigned char *data, unsigned char *key) +{ + unsigned char s_box[256]; + unsigned char index_i = 0; + unsigned char index_j = 0; + unsigned char j = 0; + int ind; + + for (ind = 0; ind < 256; ind++) + { + s_box[ind] = (unsigned char)ind; + } + + for( ind = 0; ind < 256; ind++) + { + unsigned char tc; + + j += (s_box[ind] + key[ind%16]); + + tc = s_box[ind]; + s_box[ind] = s_box[j]; + s_box[j] = tc; + } + + for( ind = 0; ind < 516; ind++) + { + unsigned char tc; + unsigned char t; + + index_i++; + index_j += s_box[index_i]; + + tc = s_box[index_i]; + s_box[index_i] = s_box[index_j]; + s_box[index_j] = tc; + + t = s_box[index_i] + s_box[index_j]; + data[ind] = data[ind] ^ s_box[t]; + } +} |