Skip to main content

lv_cat

Function lv_cat 

Source
pub fn lv_cat(parts: &[&[u8]]) -> Vec<u8> ⓘ
Expand description

Concatenates each part with its LEB128 length prepended (lv_cat from §6.3).

The length makes the encoding prefix-free, which is what lets the transcript be hashed without an ambiguity between a share and the associated data that follows it.

§Example

use syncspin_core::pairing::pake::lv_cat;

// Draft §A.1.4.
assert_eq!(
    lv_cat(&[b"1234".as_slice(), b"5", b"", b"678"]),
    [
        0x04, b'1', b'2', b'3', b'4', 0x01, b'5', 0x00, 0x03, b'6', b'7', b'8',
    ]
);