/** * @license * Copyright 2020 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ /** * Delimiter used between each template string component before hashing. Used to * prevent e.g. "foobar" and "foo${baz}bar" from sharing a hash. * * This is the "record separator" ASCII character. */ export declare const HASH_DELIMITER = "\u001E"; /** * Generate a unique ID for a lit-localize message. * * Example: * Template: html`Hello ${who}!` * Params: ["Hello ", "!"], true * Output: h82ccc38d4d46eaa9 * * The ID is constructed as: * * [0] Kind of template: [h]tml or [s]tring. * [1,16] 64-bit FNV-1a hash hex digest of the template strings, as UTF-16 * code points, delineated by an ASCII "record separator" character. * * We choose FNV-1a because: * * 1. It's pretty fast (e.g. much faster than SHA-1). * 2. It's pretty small (0.25 KiB minified + brotli). * 3. We don't require cryptographic security, and 64 bits should give * sufficient collision resistance for any one application. Worst * case, we will always detect collisions during analysis. * 4. We can't use Web Crypto API (e.g. SHA-1), because it's asynchronous. * 5. It's a well known non-cryptographic hash with implementations in many * languages. * 6. There was an existing JavaScript implementation that doesn't require * BigInt, for IE11 compatibility. */ export declare function generateMsgId(strings: string | string[] | TemplateStringsArray, isHtmlTagged: boolean): string; //# sourceMappingURL=id-generation.d.ts.map