Skip to content

dalctf 2026

Card Numbers

Cards challenge from DALCTF 2026.

Challenge Description:

I went to China a while back and while I was there I got offered a credit card. I don't know if it's a scam so I should check to see if my credit card number is valid.

first i entered a normal test card 4111111111111111 but the site said: we only accept cards from china t-union.

so i searched for china t-union card details on wikipedia:

wikipedia

https://en.wikipedia.org/wiki/Payment_card_number

issuing network: china t-union
iin ranges:      31
length:          19
validation:      luhn algorithm

so the card number needed to start with 31, be 19 digits long, and pass luhn. i made this script to generate a valid china t-union number:

generate.py

def luhn_check_digit(prefix):
    s = 0
    n = len(prefix) + 1
    for i, ch in enumerate(prefix):
        d = int(ch)
        if (n - i) % 2 == 0:
            d *= 2
            if d > 9:
                d -= 9
        s += d
    return str((10 - s % 10) % 10)

prefix = "31" + "0" * 16
num = prefix + luhn_check_digit(prefix)
print(num)

output

3100000000000000005

i entered 3100000000000000005 in the site and got the flag:

terminal

sending checksum request to server...
> dalctf{H4v1ng_fun_w1th_cr3d1t_c4rds}

Flag

dalctf{H4v1ng_fun_w1th_cr3d1t_c4rds}

Discussion

Loading discussion…

Related solves

Keep reading

Complete archive