请问stock/stock.py中的checksum算法有什么作用?
-
stock/stock.py
class stock_tracking(osv.osv):
_name = "stock.tracking"
_description = "Stock Tracking Lots"def checksum(sscc): # salt = '31313131313131313' salt = '31' * 8 + '3' sum = 0 # zip('000055',salt) = [('0', '3'), ('0', '1'), ('0', '3'), ('0', '1'), ('5', '3'), ('5', '1')] for sscc_part, salt_part in zip(sscc, salt): sum += int(sscc_part) * int(salt_part) return (10 - (sum % 10)) % 10 checksum = staticmethod(checksum)
请问stock/stock.py中的checksum算法有什么作用?[/size][/font]
-
Simon兄弟辛苦了,这是一个加密用的salt算法。