MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / expandDesKey

Function expandDesKey

pager_lib/smb/ntlm.py:187–198  ·  view source on GitHub ↗

Expand the key from a 7-byte password key into a 8-byte DES key

(key)

Source from the content-addressed store, hash-verified

185################
186
187def expandDesKey(key):
188 """Expand the key from a 7-byte password key into a 8-byte DES key"""
189 s = [ ((key[0] >> 1) & 0x7f) << 1,
190 ((key[0] & 0x01) << 6 | ((key[1] >> 2) & 0x3f)) << 1,
191 ((key[1] & 0x03) << 5 | ((key[2] >> 3) & 0x1f)) << 1,
192 ((key[2] & 0x07) << 4 | ((key[3] >> 4) & 0x0f)) << 1,
193 ((key[3] & 0x0f) << 3 | ((key[4] >> 5) & 0x07)) << 1,
194 ((key[4] & 0x1f) << 2 | ((key[5] >> 6) & 0x03)) << 1,
195 ((key[5] & 0x3f) << 1 | ((key[6] >> 7) & 0x01)) << 1,
196 (key[6] & 0x7f) << 1
197 ]
198 return bytes(s)
199
200
201def DESL(K, D):

Callers 2

DESLFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected