@hazae41/kdbx
Version:
Rust-like KeePass (KDBX 4) file format for TypeScript
28 lines (27 loc) • 912 B
JavaScript
// deno-lint-ignore-file no-namespace
export var StringAsUuid;
(function (StringAsUuid) {
function from(bytes) {
const base16 = bytes.toHex();
const a = base16.slice(0, 8);
const b = base16.slice(8, 12);
const c = base16.slice(12, 16);
const d = base16.slice(16, 20);
const e = base16.slice(20, 32);
return [a, b, c, d, e].join("-");
}
StringAsUuid.from = from;
})(StringAsUuid || (StringAsUuid = {}));
export var BytesAsUuid;
(function (BytesAsUuid) {
function from(string) {
const a = string.slice(0, 8);
const b = string.slice(9, 13);
const c = string.slice(14, 18);
const d = string.slice(19, 23);
const e = string.slice(24, 36);
const base16 = [a, b, c, d, e].join("");
return Uint8Array.fromHex(base16);
}
BytesAsUuid.from = from;
})(BytesAsUuid || (BytesAsUuid = {}));