We want to connect the people who have knowledge to the people who need it, to bring together people with different perspectives so they can understand each other better, and to empower everyone to share their knowledge.
import qrcode def generate_check_sum(text): crc = 0xFFFF # initial value polynomial = 0x1021 # 0001 0000 0010 0001 (0, 5, 12) bytes_ = text.encode("utf-8") for b in bytes_: for i in range(8): bit = ((b >> (7 - i) & 1) == 1) c15 = ((crc >> 15 & 1) == 1) crc <<= 1 if c15 ^ bit: crc ^= polynomial return format(crc & 0xFFFF, "x") bank_code = "vietinbank" bank_account = "1013772070" amount = "100000" message = "Hello" bank_id_by_code = {"vcb": "970436", "vietinbank": "970415"} bank_id = bank_id_by_code.get(bank_code) part12_builder = ( "00" + "{:02d}".format(len(bank_id)) + bank_id + "01" + "{:02d}".format(len(bank_account)) + bank_account ) part11_builder = ( "0010A000000727" + "01" + "{:02d}".format(len(part12_builder)) + part12_builder + "0208QRIBFTTA" ) part1_builder = "38" + "{:02d}".format(len(part11_builder)) + part11_builder part21_builder = "08" + "{:02d}".format(len(message)) + message part2 = ( "5303704" + "54" + "{:02d}".format(len(amount)) + amount + "5802VN" + "62" + "{:02d}".format(len(part21_builder)) + part21_builder ) builder = "000201" + "010212" + part1_builder + part2 + "6304" qrcode_content = builder + generate_check_sum(builder).upper() print(qrcode_content) img = qrcode.make(qrcode_content) img.save("my_qrcode.png")
2.2K Point(s)
1.2K Point(s)
313 Point(s)
178 Point(s)
138 Point(s)
Input your email to receive reset password link, or if you remember your password, you can click