2013年6月18日 星期二
Procedure AesEnc(str.s)
Structure AesData
len.l
Array Data.b(8191)
EndStructure
Global Aes.AesData
Procedure AesEnc(str.s)
s1.s=str
lens1=Len(s1)
If lens1 < 16
s1=s1+Space(16-lens1)
EndIf
Aes\len=AESEncoder(@s1, @Aes\Data(), Len(s1), ?Key, 128, ?InitializationVector)
EndProcedure
Procedure.s AesDec(*Buffer,reclen)
*DecipheredString = AllocateMemory(8192)
AESDecoder(*Buffer, *DecipheredString, reclen, ?Key, 128, ?InitializationVector)
ProcedureReturn RTrim(PeekS(*DecipheredString))
EndProcedure
Procedure SendAes(str.s)
AesEnc(str)
;SendNetworkData(ConnectionID,@Aes\Data(),Aes\len)
Debug Aes\Data()
Debug Aes\len
EndProcedure
SendAes("ok!")
Debug AesDec(@Aes\Data(),Aes\len)
DataSection
Key:
Data.b $06, $a9, $21, $40, $36, $b8, $a1, $5b, $51, $2e, $03, $d5, $34, $12, $00, $06
InitializationVector:
Data.b $3d, $af, $ba, $42, $9d, $9e, $b4, $30, $b4, $22, $da, $80, $2c, $9f, $ac, $41
EndDataSection
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言