AESEnvelopeProof.aes_split_v1_hex_fields: def of qasim-bend-kit@0.1.0.2 Import: import qasim-bend-kit@0.1.0.2/proof/AES_EnvelopeProof.bend as AESEnvelopeProof Lines 470-510 of qasim-bend-kit@0.1.0.2/proof/AES_EnvelopeProof.bend: https://jend.leeeet.dev/read.txt?path=qasim-bend-kit@0.1.0.2/proof/AES_EnvelopeProof.bend&start_line=470&end_line=510 import Base import qasim-bend-kit@0.1.0.2/libs/AES256GCM.bend as AES def aes_split_v1_hex_fields(+nonce: List<&2, U32>, +tag: List<&2, U32>, +ciphertext: List<&2, U32>) -> {String.split("v1." ++ AES.hex_bytes(nonce) ++ "." ++ AES.hex_bytes(tag) ++ "." ++ AES.hex_bytes(ciphertext), Chr{46}) == ["v1", AES.hex_bytes(nonce), AES.hex_bytes(tag), AES.hex_bytes(ciphertext)] : List<&2, String>}: +nonce_hex = AES.hex_bytes(nonce) +tag_hex = AES.hex_bytes(tag) +cipher_hex = AES.hex_bytes(ciphertext) +tag_suffix = tag_hex ++ "." ++ cipher_hex +nonce_suffix = nonce_hex ++ "." ++ tag_suffix cipher_split = aes_hex_bytes_split_single(ciphertext) tag_split = aes_hex_bytes_split_before_period(tag, cipher_hex) nonce_split = aes_hex_bytes_split_before_period(nonce, tag_suffix) tag_final = Equal.cong(List<&2, String>, List<&2, String>, fields => tag_hex <> fields, String.split(cipher_hex, Chr{46}), [cipher_hex], cipher_split) tag_complete = Equal.trans(List<&2, String>, String.split(tag_suffix, Chr{46}), tag_hex <> String.split(cipher_hex, Chr{46}), tag_hex <> [cipher_hex], tag_split, tag_final) nonce_final = Equal.cong(List<&2, String>, List<&2, String>, fields => nonce_hex <> fields, String.split(tag_suffix, Chr{46}), tag_hex <> [cipher_hex], tag_complete) rest_fields = Equal.cong(List<&2, String>, List<&2, String>, fields => "v1" <> fields, String.split(nonce_suffix, Chr{46}), nonce_hex <> (tag_hex <> [cipher_hex]), Equal.trans(List<&2, String>, String.split(nonce_suffix, Chr{46}), nonce_hex <> String.split(tag_suffix, Chr{46}), nonce_hex <> (tag_hex <> [cipher_hex]), nonce_split, nonce_final)) Equal.trans(List<&2, String>, String.split("v1." ++ nonce_suffix, Chr{46}), "v1" <> String.split(nonce_suffix, Chr{46}), ["v1", nonce_hex, tag_hex, cipher_hex], aes_split_v1_prefix(nonce_suffix), Equal.trans(List<&2, String>, "v1" <> String.split(nonce_suffix, Chr{46}), "v1" <> (nonce_hex <> (tag_hex <> [cipher_hex])), ["v1", nonce_hex, tag_hex, cipher_hex], rest_fields, {==})) Uses (12): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Char https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Equal.cong https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Equal.trans https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String.append https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String.split https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=qasim-bend-kit@0.1.0.2/libs/AES256GCM.bend&name=hex_bytes https://jend.leeeet.dev/definition.txt?path=qasim-bend-kit@0.1.0.2/proof/AES_EnvelopeProof.bend&name=aes_hex_bytes_split_before_period https://jend.leeeet.dev/definition.txt?path=qasim-bend-kit@0.1.0.2/proof/AES_EnvelopeProof.bend&name=aes_hex_bytes_split_single https://jend.leeeet.dev/definition.txt?path=qasim-bend-kit@0.1.0.2/proof/AES_EnvelopeProof.bend&name=aes_split_v1_prefix