Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
44
Task/OpenWebNet-password/11l/openwebnet-password.11l
Normal file
44
Task/OpenWebNet-password/11l/openwebnet-password.11l
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
F ownCalcPass(password, nonce)
|
||||
UInt32 result
|
||||
V start = 1B
|
||||
L(c) nonce
|
||||
I c != ‘0’ & start
|
||||
result = UInt32(Int(password))
|
||||
start = 0B
|
||||
S c
|
||||
‘0’
|
||||
{}
|
||||
‘1’
|
||||
result = rotr(result, 7)
|
||||
‘2’
|
||||
result = rotr(result, 4)
|
||||
‘3’
|
||||
result = rotr(result, 3)
|
||||
‘4’
|
||||
result = rotl(result, 1)
|
||||
‘5’
|
||||
result = rotl(result, 5)
|
||||
‘6’
|
||||
result = rotl(result, 12)
|
||||
‘7’
|
||||
result = (result [&] 0000'FF00) [|] result << 24 [|]
|
||||
(result [&] 00FF'0000) >> 16 [|] (result [&] FF00'0000) >> 8
|
||||
‘8’
|
||||
result = result << 16 [|] result >> 24 [|] (result [&] 00FF'0000) >> 8
|
||||
‘9’
|
||||
result = (-)result
|
||||
E
|
||||
X ValueError(‘non-digit in nonce.’)
|
||||
R result
|
||||
|
||||
F test_passwd_calc(passwd, nonce, expected)
|
||||
V res = ownCalcPass(passwd, nonce)
|
||||
V m = passwd‘ ’nonce‘ ’res‘ ’expected
|
||||
I res == expected
|
||||
print(‘PASS ’m)
|
||||
E
|
||||
print(‘FAIL ’m)
|
||||
|
||||
test_passwd_calc(‘12345’, ‘603356072’, 25280520)
|
||||
test_passwd_calc(‘12345’, ‘410501656’, 119537670)
|
||||
test_passwd_calc(‘12345’, ‘630292165’, 4269684735)
|
||||
Loading…
Add table
Add a link
Reference in a new issue