Sha256: a72aa34c8e3b64aa29802a525f38e2bf6dce4e8da068e62b26e4f583b89bcb44
Contents?: true
Size: 345 Bytes
Versions: 125
Compression:
Stored size: 345 Bytes
Contents
from functools import reduce def hexa(hex_str): hex_str = hex_str.lower() if set(hex_str) - set('0123456789abcdef'): raise ValueError('Invalid hexadecimal string') digits = [ord(c) - ord('a') + 10 if c in 'abcdef' else ord(c) - ord('0') for c in hex_str] return reduce(lambda x, y: x * 16 + y, digits, 0)
Version data entries
125 entries across 125 versions & 1 rubygems