byt32 0.1.1

A CLI tool for converting 'str to hex' or 'hex to str'
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use aoko::no_std::functions::ext::{Utf8Ext, AnyExt1};
use num::BigUint;

pub mod cli;

pub fn str_to_hex(s: &str) {
    println!("0x{:0<64x}", s.as_bytes().let_owned(BigUint::from_bytes_be))
}

pub fn hex_to_str(h: &str) {
    println!("{}", h.trim_start_matches("0x").let_ref(hex::decode).unwrap().to_str().unwrap())
}