encode_felt
Encodes a felt252 value into Base64 formatThis function converts a felt252 value to its Base64 representation using a specialized algorithm that handles the large numeric range of felt252. The encoding process divides the felt252 into manageable chunks and maps them to Base64 characters, with padding to ensure consistent output length.
Arguments
self
- The felt252 value to be encodedbase64_chars
- A span containing the Base64 character set for encoding
Returns
Array<u8>
- The Base64 encoded result as an array of bytes, always 44 characters long # Algorithm 1. Converts felt252 to u256 for processing 2. Processes the number in chunks using division and modulo operations 3. Maps the resulting values to Base64 characters 4. Pads with 'A' characters to reach the standard 43-character length 5. Reverses the result and appends '=' padding character
Fully qualified path: alexandria_encoding::base64::encode_felt
#![allow(unused)] fn main() { pub fn encode_felt(self: felt252, base64_chars: Span<u8>) -> Array<u8> }