New function, llSHA256String

Implement it in lslbasefuncs.py, and add tests. Also add more test vectors for llMD5String and llSHA1String.
This commit is contained in:
Sei Lisa 2022-10-14 18:39:04 +02:00
parent 8966b9de97
commit 9c281dec64
5 changed files with 21 additions and 1 deletions

View file

@ -1,4 +1,4 @@
// Generated by LSL2 Derived Files Generator. Database version: 0.0.20220928000; output module version: 0.0.20140731000
// Generated by LSL2 Derived Files Generator. Database version: 0.0.20221014000; output module version: 0.0.20140731000
integer llAbs( integer val )
float llAcos( float val )
void llAddToLandBanList( key avatar, float hours )
@ -343,6 +343,7 @@ void llRotTargetRemove( integer number )
void llRotateTexture( float angle, integer face )
integer llRound( float val )
string llSHA1String( string src )
string llSHA256String( string src )
integer llSameGroup( key id )
void llSay( integer channel, string msg )
integer llScaleByFactor( float scaling_factor )

View file

@ -1275,6 +1275,9 @@ integer llRound(float val)
string llSHA1String(string src)
- SEF
string llSHA256String(string src)
- SEF
integer llSameGroup(key id)
- SEF
- min 0

View file

@ -1916,6 +1916,10 @@ def llSHA1String(s):
s = fs(s)
return str2u(hashlib.sha1(s.encode('utf8')).hexdigest(), 'utf8')
def llSHA256String(s):
s = fs(s)
return str2u(hashlib.sha256(s.encode('utf8')).hexdigest(), 'utf8')
def llSin(f):
f = ff(f)
if math.isinf(f):

View file

@ -9,5 +9,11 @@
, llGetListEntryType([], 0)
, llGetListEntryType([[]], 0)
, llMD5String("", 0)
, llMD5String("abc", 0)
, llMD5String("abc", 1)
, llMD5String("abc", -12345)
, llSHA1String("")
, llSHA1String("abc")
, llSHA256String("")
, llSHA256String("abc")
]

View file

@ -9,5 +9,11 @@
, 0
, 0
, "1a9d5db22c73a993ff0b42f64b396873"
, "cf4bab410c5a562ddef8587f22c939ca"
, "7faac3319aba94a00596f1e271d9da82"
, "412323da7b625c5890ff4f8641451565"
, "da39a3ee5e6b4b0d3255bfef95601890afd80709"
, "a9993e364706816aba3e25717850c26c9cd0d89d"
, "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
, "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"
]