Data update
This commit is contained in:
parent
ed705008a8
commit
0df55f9f24
2196 changed files with 32999 additions and 3075 deletions
|
|
@ -26,7 +26,7 @@ F ownCalcPass(password, nonce)
|
|||
‘8’
|
||||
result = result << 16 [|] result >> 24 [|] (result [&] 00FF'0000) >> 8
|
||||
‘9’
|
||||
result = (-)result
|
||||
result = ~result
|
||||
E
|
||||
X ValueError(‘non-digit in nonce.’)
|
||||
R result
|
||||
|
|
|
|||
61
Task/OpenWebNet-password/EasyLang/openwebnet-password.easy
Normal file
61
Task/OpenWebNet-password/EasyLang/openwebnet-password.easy
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
func calcpass passw$ nonce$ .
|
||||
start = 1
|
||||
passw = number passw$
|
||||
for c$ in strchars nonce$
|
||||
if c$ <> "0"
|
||||
if start = 1
|
||||
num2 = passw
|
||||
.
|
||||
start = 0
|
||||
.
|
||||
if c$ = "1"
|
||||
num1 = bitshift bitand num2 0xFFFFFF80 -7
|
||||
num2 = bitshift num2 25
|
||||
elif c$ = "2"
|
||||
num1 = bitshift bitand num2 0xFFFFFFF0 -4
|
||||
num2 = bitshift num2 28
|
||||
elif c$ = "3"
|
||||
num1 = bitshift bitand num2 0xFFFFFFF8 -3
|
||||
num2 = bitshift num2 29
|
||||
elif c$ = "4"
|
||||
num1 = bitshift num2 1
|
||||
num2 = bitshift num2 -31
|
||||
elif c$ = "5"
|
||||
num1 = bitshift num2 5
|
||||
num2 = bitshift num2 -27
|
||||
elif c$ = "6"
|
||||
num1 = bitshift num2 12
|
||||
num2 = bitshift num2 -20
|
||||
elif c$ = "7"
|
||||
h1 = bitand num2 0x0000FF00
|
||||
h2 = bitshift bitand num2 0x000000FF 24
|
||||
h3 = bitshift bitand num2 0x00FF0000 -16
|
||||
num1 = bitor bitor h1 h2 h3
|
||||
num2 = bitshift bitand num2 0xFF000000 -8
|
||||
elif c$ = "8"
|
||||
num1 = bitor bitshift bitand num2 0x0000FFFF 16 bitshift num2 -24
|
||||
num2 = bitshift bitand num2 0x00FF0000 -8
|
||||
elif c$ = "9"
|
||||
num1 = bitnot num2
|
||||
else
|
||||
num1 = num2
|
||||
.
|
||||
if c$ <> "0" and c$ <> "9"
|
||||
num1 = bitor num1 num2
|
||||
.
|
||||
num2 = num1
|
||||
.
|
||||
return num1
|
||||
.
|
||||
proc test_passwd passwd$ nonce$ expected$ . .
|
||||
res = calcpass passwd$ nonce$
|
||||
m$ = passwd$ & " " & nonce$ & " " & res & " " & expected$
|
||||
if res = number expected$
|
||||
print "PASS " & m$
|
||||
else
|
||||
print "FAIL " & m$
|
||||
.
|
||||
.
|
||||
test_passwd "12345" "603356072" "25280520"
|
||||
test_passwd "12345" "410501656" "119537670"
|
||||
test_passwd "12345" "630292165" "4269684735"
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import "/fmt" for Fmt
|
||||
import "./fmt" for Fmt
|
||||
|
||||
var ownCalcPass = Fn.new { |password, nonce|
|
||||
var start = true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue