mirror of
https://github.com/susMdT/AceLdr
synced 2026-06-08 17:38:55 +00:00
26 lines
524 B
Python
26 lines
524 B
Python
#!/usr/bin/env python3
|
|
# -*- coding:utf-8 -*-
|
|
|
|
#
|
|
# https://github.com/SecIdiot/TitanLdr/blob/master/python3/hashstring.py
|
|
#
|
|
|
|
import sys
|
|
|
|
def hash_string( string ):
|
|
try:
|
|
hash = 5381
|
|
|
|
for x in string.upper():
|
|
hash = (( hash << 5 ) + hash ) + ord(x)
|
|
|
|
return hash & 0xFFFFFFFF
|
|
except:
|
|
pass
|
|
|
|
if __name__ in '__main__':
|
|
try:
|
|
print('0x%x' % hash_string(sys.argv[1]));
|
|
except IndexError:
|
|
print('usage: %s [string]' % sys.argv[0]);
|