Skip to content

Instantly share code, notes, and snippets.

@artiya4u
Last active February 13, 2026 05:33
Show Gist options
  • Select an option

  • Save artiya4u/8925adfd8565cb8904c19cafaa7b8cf9 to your computer and use it in GitHub Desktop.

Select an option

Save artiya4u/8925adfd8565cb8904c19cafaa7b8cf9 to your computer and use it in GitHub Desktop.
vote_id_1 = 14399212
expected_qr_1 = 'EH1RQ'
vote_id_2 = 20516201
expected_qr_2 = 'W2231'
def get_card_number(gr_string):
# Constants
MODULUS = 60466176
OFFSET = 46913010
# The CORRECT Modular Multiplicative
INVERSE = 46213067
x = int(gr_string, 36)
card_number = (INVERSE * (x - OFFSET)) \
% MODULUS
return card_number
def excel_base_mod(vote_id):
r = (35477987 * vote_id + 46913010) % 60466176
if r == 0:
return '0'
digits = []
while r > 0:
remainder = r % 36
if remainder < 10:
digits.append(str(remainder))
else:
digits.append(chr(ord('a') + remainder - 10))
r //= 36
return ''.join(reversed(digits))
result1 = excel_base_mod(vote_id_1)
result2 = excel_base_mod(vote_id_2)
print(f'Vote ID {vote_id_1}: calculated={result1.upper()}, expected={expected_qr_1}, match={result1.upper() == expected_qr_1}')
print(f'Vote ID {vote_id_2}: calculated={result2.upper()}, expected={expected_qr_2}, match={result2.upper() == expected_qr_2}')
print('-' * 80)
expected_qr_3 = 'NZSCW'
a = get_card_number(expected_qr_3)
b = excel_base_mod(a)
print(f'✅Found QR code for Vote ID {a}->{b.upper()}')
for i in range(0, 100_000_000):
result = excel_base_mod(i).upper()
if result.upper() == expected_qr_3:
print(f'✅Found QR code for Vote ID {i}->{expected_qr_3}')
break
else:
print(f'❌Not found QR code for {expected_qr_3}!')
print('-' * 80)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment