belt-ecb 0.0.1

Generic implementation of the belt-ecb block mode of operation (STB 34.101.31-2020)
Documentation
  • Coverage
  • 100%
    1 out of 1 items documented0 out of 1 items with examples
  • Size
  • Source code size: 2.27 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 79.23 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • RustCrypto/block-modes
    64 13 3
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • newpavlov

This crate is deprecated.

For implementation of the belt-ecb mode you can use the cts crate with block cipher implementation from the belt-block crate:

use cts::{Decrypt, Encrypt, KeyInit};
use hex_literal::hex;

type BeltEcb = cts::EcbCs2<belt_block::BeltBlock>;

// Test vector from STB 34.101.31-2020, table A.9
let key = hex!(
    "E9DEE72C 8F0C0FA6 2DDB49F4 6F739647"
    "06075316 ED247A37 39CBA383 03A98BF6"
);
let pt = hex!(
    "B194BAC8 0A08F53B 366D008E 584A5DE4"
    "8504FA9D 1BB6C7AC 252E72C2 02FDCE0D"
    "5BE3D612 17B96181 FE6786AD 716B890B"
);
let ct = hex!(
    "69CCA1C9 3557C9E3 D66BC3E0 FA88FA6E"
    "5F23102E F1097107 75017F73 806DA9DC"
    "46FB2ED2 CE771F26 DCB5E5D1 569F9AB0"
);

let mut buf = [0u8; 48];

BeltEcb::new(&key.into()).encrypt_b2b(&pt, &mut buf).unwrap();
assert_eq!(buf, ct);

BeltEcb::new(&key.into()).decrypt(&mut buf).unwrap();
assert_eq!(buf, pt);