{"version":3,"file":"x64-core.cjs","names":["Base","x32Words: number[]","WordArray"],"sources":["../src/x64-core.ts"],"sourcesContent":["import {\n  Base,\n  WordArray,\n} from './core';\n\n/**\n * A 64-bit word representation.\n * Stores a 64-bit value as two 32-bit words due to JavaScript's number limitations.\n * \n * @property high - The high 32 bits\n * @property low - The low 32 bits\n */\nexport class X64Word extends Base {\n  /** The high 32 bits of the 64-bit word */\n  high: number;\n  \n  /** The low 32 bits of the 64-bit word */\n  low: number;\n\n  /**\n   * Initializes a newly created 64-bit word.\n   * \n   * @param high - The high 32 bits (default: 0)\n   * @param low - The low 32 bits (default: 0)\n   * @example\n   * ```javascript\n   * const x64Word = new X64Word(0x00010203, 0x04050607);\n   * const x64Word = X64Word.create(0x00010203, 0x04050607);\n   * ```\n   */\n  constructor(high: number = 0, low: number = 0) {\n    super();\n    this.high = high;\n    this.low = low;\n  }\n\n  /**\n   * Creates a copy of this word.\n   * \n   * @returns The cloned 64-bit word\n   * @example\n   * ```javascript\n   * const clone = x64Word.clone();\n   * ```\n   */\n  clone(): this {\n    const clone = super.clone();\n    clone.high = this.high;\n    clone.low = this.low;\n    return clone;\n  }\n}\n\n/**\n * An array of 64-bit words.\n * This is used for algorithms that operate on 64-bit words, such as SHA-512.\n * \n * @property words - The array of X64Word objects\n * @property sigBytes - The number of significant bytes in this word array\n */\nexport class X64WordArray extends Base {\n  /** The array of X64Word objects */\n  words: X64Word[];\n  \n  /** The number of significant bytes in this word array */\n  sigBytes: number;\n\n  /**\n   * Initializes a newly created 64-bit word array.\n   * \n   * @param words - An array of X64Word objects\n   * @param sigBytes - The number of significant bytes in the words (defaults to words.length * 8)\n   * @example\n   * ```javascript\n   * const wordArray = new X64WordArray();\n   * \n   * const wordArray = new X64WordArray([\n   *   new X64Word(0x00010203, 0x04050607),\n   *   new X64Word(0x18191a1b, 0x1c1d1e1f)\n   * ]);\n   * \n   * const wordArray = new X64WordArray([\n   *   new X64Word(0x00010203, 0x04050607),\n   *   new X64Word(0x18191a1b, 0x1c1d1e1f)\n   * ], 10);\n   * ```\n   */\n  constructor(words: X64Word[] = [], sigBytes: number = words.length * 8) {\n    super();\n    this.words = words;\n    this.sigBytes = sigBytes;\n  }\n\n  /**\n   * Factory method to create a 64-bit word array.\n   * \n   * @param words - An array of X64Word objects\n   * @param sigBytes - The number of significant bytes\n   * @returns A new X64WordArray instance\n   * @static\n   * @example\n   * ```javascript\n   * const wordArray = X64WordArray.create([\n   *   X64Word.create(0x00010203, 0x04050607)\n   * ]);\n   * ```\n   */\n  static create(words?: X64Word[], sigBytes?: number): X64WordArray;\n  static create<T extends X64WordArray>(this: new (...args: any[]) => T, ...args: any[]): T;\n  static create(...args: any[]): any {\n    const [words, sigBytes] = args;\n    return new X64WordArray(words, sigBytes);\n  }\n\n  /**\n   * Converts this 64-bit word array to a 32-bit word array.\n   * Each 64-bit word is split into two 32-bit words (high and low).\n   * \n   * @returns This word array's data as a 32-bit word array\n   * @example\n   * ```javascript\n   * const x32WordArray = x64WordArray.toX32();\n   * ```\n   */\n  toX32(): WordArray {\n    const x64Words = this.words;\n    const x64WordsLength = x64Words.length;\n\n    // Convert each 64-bit word to two 32-bit words\n    const x32Words: number[] = [];\n    for (let i = 0; i < x64WordsLength; i += 1) {\n      const x64Word = x64Words[i];\n      x32Words.push(x64Word.high);\n      x32Words.push(x64Word.low);\n    }\n\n    return WordArray.create(x32Words, this.sigBytes);\n  }\n\n  /**\n   * Creates a deep copy of this word array.\n   * Clones both the array and each X64Word object within it.\n   * \n   * @returns The cloned X64WordArray\n   * @example\n   * ```javascript\n   * const clone = x64WordArray.clone();\n   * ```\n   */\n  clone(): this {\n    const clone = super.clone();\n\n    // Clone the words array\n    clone.words = this.words.slice(0);\n    const { words } = clone;\n\n    // Clone each X64Word object\n    const wordsLength = words.length;\n    for (let i = 0; i < wordsLength; i += 1) {\n      words[i] = words[i].clone();\n    }\n\n    return clone;\n  }\n}"],"mappings":";;;;;;;;;;AAYA,IAAa,UAAb,cAA6BA,kBAAK;;CAEhC;;CAGA;;;;;;;;;;;;CAaA,YAAY,OAAe,GAAG,MAAc,GAAG;AAC7C;AACA,OAAK,OAAO;AACZ,OAAK,MAAM;CACZ;;;;;;;;;;CAWD,QAAc;EACZ,MAAM,QAAQ,MAAM;AACpB,QAAM,OAAO,KAAK;AAClB,QAAM,MAAM,KAAK;AACjB,SAAO;CACR;AACF;;;;;;;;AASD,IAAa,eAAb,MAAa,qBAAqBA,kBAAK;;CAErC;;CAGA;;;;;;;;;;;;;;;;;;;;;CAsBA,YAAY,QAAmB,EAAE,EAAE,WAAmB,MAAM,SAAS,GAAG;AACtE;AACA,OAAK,QAAQ;AACb,OAAK,WAAW;CACjB;CAkBD,OAAO,OAAO,GAAG,MAAkB;EACjC,MAAM,CAAC,OAAO,SAAS,GAAG;AAC1B,SAAO,IAAI,aAAa,OAAO;CAChC;;;;;;;;;;;CAYD,QAAmB;EACjB,MAAM,WAAW,KAAK;EACtB,MAAM,iBAAiB,SAAS;EAGhC,MAAMC,WAAqB,EAAE;AAC7B,OAAK,IAAI,IAAI,GAAG,IAAI,gBAAgB,KAAK,GAAG;GAC1C,MAAM,UAAU,SAAS;AACzB,YAAS,KAAK,QAAQ;AACtB,YAAS,KAAK,QAAQ;EACvB;AAED,SAAOC,uBAAU,OAAO,UAAU,KAAK;CACxC;;;;;;;;;;;CAYD,QAAc;EACZ,MAAM,QAAQ,MAAM;AAGpB,QAAM,QAAQ,KAAK,MAAM,MAAM;EAC/B,MAAM,EAAE,OAAO,GAAG;EAGlB,MAAM,cAAc,MAAM;AAC1B,OAAK,IAAI,IAAI,GAAG,IAAI,aAAa,KAAK,EACpC,OAAM,KAAK,MAAM,GAAG;AAGtB,SAAO;CACR;AACF"}