diff --git a/core/encoding/base32/base32.odin b/core/encoding/base32/base32.odin index b6af279ec..0b8ec95c4 100644 --- a/core/encoding/base32/base32.odin +++ b/core/encoding/base32/base32.odin @@ -1,3 +1,5 @@ +// Base32 encoding/decoding implementation as specified in RFC 4648. +// [[ More; https://www.rfc-editor.org/rfc/rfc4648.html ]] package encoding_base32 // @note(zh): Encoding utility for Base32 @@ -8,7 +10,10 @@ package encoding_base32 // truncate it from the encoded output. // Error represents errors that can occur during base32 decoding operations. -// See RFC 4648 sections 3.2, 4 and 6. +// As per RFC 4648: +// - Section 3.3: Invalid character handling +// - Section 3.2: Padding requirements +// - Section 6: Base32 encoding specifics (including block size requirements) Error :: enum { None, Invalid_Character, // Input contains characters outside the specified alphabet diff --git a/core/encoding/base32/base32_test.odin b/core/encoding/base32/base32_test.odin index b032aa122..ea41ae36f 100644 --- a/core/encoding/base32/base32_test.odin +++ b/core/encoding/base32/base32_test.odin @@ -57,7 +57,7 @@ test_base32_encode :: proc(t: ^testing.T) { @(test) test_base32_decode_invalid :: proc(t: ^testing.T) { - // Section 3.2 - Alphabet check + // Section 3.3 - Non-alphabet characters { // Characters outside alphabet input := "MZ1W6YTB" // '1' not in alphabet (A-Z, 2-7) @@ -77,7 +77,7 @@ test_base32_decode_invalid :: proc(t: ^testing.T) { testing.expect_value(t, err, Error.Invalid_Character) } - // Section 4 - Padding requirements + // Section 3.2 - Padding requirements { // Padding must only be at end input := "MZ=Q====" @@ -115,7 +115,7 @@ test_base32_decode_invalid :: proc(t: ^testing.T) { testing.expect_value(t, err, Error.Malformed_Input) } - // Section 6 - Block size requirements + // Section 6 - Base32 block size requirements { // Single character (invalid block) input := "M"