Skip to content

Document and give example for alsw implementation #38

Open
@tugtugtug

Description

@tugtugtug

Hi Nugine,
I'm planning to add a new charset support to simd-base32, and is stuck with the alsw decoder implementation.
Given that the charset is:

const BASE32CROCKFORD_CHARSET: &[u8; 32] = b"0123456789ABCDEFGHJKMNPQRSTVWXYZ";

I have the decode function as:

    #[inline]
    const fn decode(c: u8) -> u8 {
        match c {
            b'0'..=b'9' => c - b'0',
            b'A'..=b'H' => c - b'A' + 10,
            b'J'..=b'K' => c - b'J' + 18,
            b'M'..=b'N' => c - b'M' + 20,
            b'P'..=b'T' => c - b'P' + 22,
            b'V'..=b'Z' => c - b'V' + 27,
            _ => 0xff,
        }
    }

But it is unclear to me how the check_hash function is implemented. Would you please add some documentation to the implementation and the verification of such functions?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions