Skip to content

Commit

Permalink
TEA -> xTEA #8
Browse files Browse the repository at this point in the history
  • Loading branch information
joedf committed Feb 13, 2015
1 parent c3fdca1 commit 7190829
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 180 deletions.
File renamed without changes.
180 changes: 0 additions & 180 deletions src/TEA.ahk

This file was deleted.

70 changes: 70 additions & 0 deletions src/xTEA.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
; http://www.cix.co.uk/%7Eklockstone/xtea.pdf
LC_xTEA_Encrypt(Data,Keys:="") {

; Default Keys
static k := [ 0x11111111 ; 128-bit secret key
, 0x22222222
, 0x33333333 ; choose wisely!
, 0x44444444 ]

Loop 4
{
if StrLen(k[A_Index])
k[A_Index] := Keys[A_Index]
else
break
}

bkpBL:=A_BatchLines,bkpSCS:=A_StringCaseSense,bkpAT:=A_AutoTrim,bkpFI:=A_FormatInteger
SetBatchLines -1
StringCaseSense Off
AutoTrim Off

k5:=SubStr(A_NowUTC,1,8) ; current time
v:=SubStr(A_NowUTC,-5)
v:=LC_Hex2Dec((v*1000)+A_MSec) ; in MSec


; Implementation


SetBatchLines,%bkpBL%
StringCaseSense,%bkpSCS%
AutoTrim,%bkpAT%
SetFormat,Integer,%bkpFI%

Return L
}


LC_xTEA_Decrypt(Data,Keys:="") {

; Default Keys
static k := [ 0x11111111 ; 128-bit secret key
, 0x22222222
, 0x33333333 ; choose wisely!
, 0x44444444 ]

Loop 4
{
if StrLen(k[A_Index])
k[A_Index] := Keys[A_Index]
else
break
}

bkpBL:=A_BatchLines,bkpSCS:=A_StringCaseSense,bkpAT:=A_AutoTrim
SetBatchLines -1
StringCaseSense Off
AutoTrim Off


; Implementation


SetBatchLines,%bkpBL%
StringCaseSense,%bkpSCS%
AutoTrim,%bkpAT%

Return L
}

0 comments on commit 7190829

Please sign in to comment.