Encode to hex

    0

    0

    Giovanny Gongora

    Codiga's Rust Recipes

    encode using HEXUPPER

    use data_encoding::{HEXUPPER, DecodeError};
    
    fn main() -> Result<(), DecodeError> {
      let original = b"The quick brown fox jumps over the lazy dog.";
      let expected = "54686520717569636B2062726F776E20666F78206A756D7073206F76\
      657220746865206C617A7920646F672E";
      let encoded = HEXUPPER.encode(original);
      assert_eq!(encoded, expected);
      Ok(())
    }
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Explore
    • Cookbooks
    • Playground
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.