mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-02 16:18:19 +00:00
Update to kwdb 0.0.20240415000
Quite some new functions and constants.
This commit is contained in:
parent
f854e94349
commit
b7f16900ed
9 changed files with 193 additions and 39 deletions
|
@ -1159,6 +1159,37 @@ def llChar(code):
|
|||
return u'' if code == 0 else u'\uFFFD'
|
||||
return unichr(code)
|
||||
|
||||
def InternalGetAlg(alg):
|
||||
hash = None
|
||||
if alg == u'md5':
|
||||
hash = hashlib.md5()
|
||||
elif alg == u'sha1':
|
||||
hash = hashlib.sha1()
|
||||
elif alg == u'sha224':
|
||||
hash = hashlib.sha224()
|
||||
elif alg == u'sha256':
|
||||
hash = hashlib.sha256()
|
||||
elif alg == u'sha384':
|
||||
hash = hashlib.sha384()
|
||||
elif alg == u'sha512':
|
||||
hash = hashlib.sha512()
|
||||
return hash
|
||||
|
||||
def llComputeHash(data, alg):
|
||||
data = bytewrap(uniwrap(fs(data)).encode('utf8'))
|
||||
alg = fs(alg)
|
||||
hash = InternalGetAlg(alg if alg != u'md5_sha1' else u'md5')
|
||||
if hash is None:
|
||||
raise ELSLCantCompute # spews error
|
||||
hash.update(data)
|
||||
ret = hash.hexdigest()
|
||||
if alg == u'md5_sha1':
|
||||
# md5_sha1 consists of concatenating the MD5 and the SHA-1
|
||||
hash = InternalGetAlg(u'sha1')
|
||||
hash.update(data)
|
||||
ret += hash.hexdigest()
|
||||
return ret.decode('utf8')
|
||||
|
||||
def llCos(f):
|
||||
f = ff(f)
|
||||
if math.isinf(f):
|
||||
|
@ -1308,19 +1339,7 @@ def llHMAC(pwd, data, alg):
|
|||
pwd = bytewrap(uniwrap(fs(pwd)).encode('utf8'))
|
||||
data = bytewrap(uniwrap(fs(data)).encode('utf8'))
|
||||
alg = fs(alg)
|
||||
hash = None
|
||||
if alg == u'md5':
|
||||
hash = hashlib.md5()
|
||||
elif alg == u'sha1':
|
||||
hash = hashlib.sha1()
|
||||
elif alg == u'sha224':
|
||||
hash = hashlib.sha224()
|
||||
elif alg == u'sha256':
|
||||
hash = hashlib.sha256()
|
||||
elif alg == u'sha384':
|
||||
hash = hashlib.sha384()
|
||||
elif alg == u'sha512':
|
||||
hash = hashlib.sha512()
|
||||
hash = InternalGetAlg(alg)
|
||||
if hash is None:
|
||||
raise ELSLCantCompute # spews error
|
||||
# Calculate the HMAC here, to avoid requiring yet another module
|
||||
|
@ -1536,6 +1555,12 @@ def llListFindList(lst, elems):
|
|||
return i
|
||||
return -1
|
||||
|
||||
def llListFindListNext(src, test, n):
|
||||
src = fl(src)
|
||||
test = fl(test)
|
||||
n = fi(n)
|
||||
raise eLSLCantCompute # TODO: Implement llListFindListNext
|
||||
|
||||
def llListFindStrided(src, test, start, end, stride):
|
||||
src = fl(src)
|
||||
test = fl(test)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue