def decode_ed25519(limbs):
    """
    Decodes hexcoded limbs with 25.5 radix to Zmod(2^255-19) integer

    :param n:
    :return:
    """
    n = 0
    c = 0
    shift = 0
    bits = [26, 25, 26, 25, 26, 25, 26, 25, 26, 25]
    for i in range(10):
        n += (limbs[i] & (1 << bits[i]) - 1) + c << shift
        c = limbs[i] >> bits[i]
        shift += bits[i]
    return n
