(ns Base "Elixir Base module — encoding/decoding (base16, base32, base64). In CljElixir: (Base/encode64 data), (Base/decode16 hex-string), etc.") (defn encode16 "Encodes binary to base-16 (hex) string. (Base/encode16 \"hello\") ;=> \"68656C6C6F\" (Base/encode16 \"hello\" :case :lower) ;=> \"68656c6c6f\"" ([data]) ([data opts])) (defn decode16 "Decodes a base-16 string. Returns {:ok binary} or :error. (Base/decode16 \"68656C6C6F\") ;=> {:ok \"hello\"}" ([string]) ([string opts])) (defn decode16! "Decodes base-16. Raises on error. (Base/decode16! \"68656C6C6F\") ;=> \"hello\"" ([string]) ([string opts])) (defn encode32 "Encodes binary to base-32 string. (Base/encode32 \"hello\") ;=> \"NBSWY3DP\"" ([data]) ([data opts])) (defn decode32 "Decodes a base-32 string. Returns {:ok binary} or :error." ([string]) ([string opts])) (defn decode32! "Decodes base-32. Raises on error." ([string]) ([string opts])) (defn encode64 "Encodes binary to base-64 string. (Base/encode64 \"hello\") ;=> \"aGVsbG8=\"" ([data]) ([data opts])) (defn decode64 "Decodes a base-64 string. Returns {:ok binary} or :error. (Base/decode64 \"aGVsbG8=\") ;=> {:ok \"hello\"}" ([string]) ([string opts])) (defn decode64! "Decodes base-64. Raises on error. (Base/decode64! \"aGVsbG8=\") ;=> \"hello\"" ([string]) ([string opts])) (defn url-encode64 "Encodes binary to URL-safe base-64. (Base/url-encode64 data) ;=> URL-safe base64 string" ([data]) ([data opts])) (defn url-decode64 "Decodes URL-safe base-64. Returns {:ok binary} or :error." ([string]) ([string opts])) (defn url-decode64! "Decodes URL-safe base-64. Raises on error." ([string]) ([string opts])) (defn hex-encode32 "Encodes binary to hex-base-32 (Extended Hex)." ([data]) ([data opts])) (defn hex-decode32 "Decodes hex-base-32." ([string]) ([string opts])) (defn hex-decode32! "Decodes hex-base-32. Raises on error." ([string]) ([string opts]))