The unpac monorepo manager self-hosting as a monorepo using unpac
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Return string alphabet

Change [Base64.alphabet] to return the string representation of the
alphabet instead of leaking the internal array.

authored by

Reynir Björnsson and committed by
dinosaure
6b871780 d1d15641

+2 -10
+1 -1
vendor/opam/base64/src/base64.ml
··· 57 57 58 58 let length_alphabet { emap; _ } = Array.length emap 59 59 60 - let alphabet { emap; _ } = emap 60 + let alphabet { emap; _ } = String.init (Array.length emap) (fun i -> Char.chr emap.(i)) 61 61 62 62 let default_alphabet = 63 63 make_alphabet
+1 -1
vendor/opam/base64/src/base64.mli
··· 45 45 val length_alphabet : alphabet -> int 46 46 (** Returns length of the alphabet, should be 64. *) 47 47 48 - val alphabet : alphabet -> int array 48 + val alphabet : alphabet -> string 49 49 (** Returns the alphabet. *) 50 50 51 51 val decode_exn :
-8
vendor/opam/base64/test/test.ml
··· 184 184 Alcotest.(check (option string)) (sprintf "decode %S" input) res' res) 185 185 nocrypto_tests 186 186 187 - let test_reynir () = 188 - let r = "Hello, World!" in 189 - let a = Base64.(alphabet default_alphabet) in 190 - let () = Array.iteri (fun i _ -> a.(i) <- int_of_char 'A') a in 191 - Alcotest.(check string) "decode encode after mutating default_alphabet" 192 - r Base64.(decode_exn (encode_string r)) 193 - 194 187 exception Malformed 195 188 196 189 exception Wrong_padding ··· 316 309 ("Cfcs test vectors", `Quick, test_cfcs); 317 310 ("PHP test vectors", `Quick, test_php); 318 311 ("Nocrypto test vectors", `Quick, test_nocrypto); 319 - ("Reynir test vectors", `Quick, test_reynir); 320 312 ] 321 313 322 314 let () =