Skip to main content

encrypt

Function encrypt 

Source
pub fn encrypt(plain: &[u8], r: u16) -> (Vec<u8>, u16)
Expand description

Encrypts plain with the initial key r (encrypt); returns the ciphertext and the key for a subsequent encryption.

Like fontTools, this does not add the random bytes the Type 1 specification prefixes the plaintext with.

use fontoxide_misc::eexec::encrypt;
let (cipher, r) = encrypt(b"0d\nh\x15\xe8\xc4\xb2\x15\x1d\x108\x1a<6\xa1", 12321);
assert_eq!(cipher, b"\0\0asdadads asds\xb5");
assert_eq!(r, 36142);