mirror of
https://github.com/benheise/TitanLdr
synced 2026-06-06 15:14:33 +00:00
21 lines
420 B
Python
21 lines
420 B
Python
#!/usr/bin/env python3
|
|
# -*- coding:utf-8 -*-
|
|
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]);
|