UNPKG

@li0ard/crapto1_ts

Version:
57 lines (56 loc) 1.81 kB
/** Crypto1 state */ export declare class Crypto1State { odd: number; even: number; constructor(odd?: number, even?: number); /** Initialize state from key (aka LFSR value) */ static fromKey(key: bigint): Crypto1State; /** Get LFSR value (aka Key) */ get lfsr(): bigint; /** Get filtered state `odd` value */ get peekCrypto1Bit(): number; /** * Generate keystream (bit) * @param input Input bit * @param isEncrypted Is input bit encrypted? */ bit(input?: number, isEncrypted?: boolean): number; /** * Generate keystream (byte) * @param input Input byte * @param isEncrypted Is input byte encrypted? */ byte(input?: number, isEncrypted?: boolean): number; /** * Generate keystream (word) * @param input Input word (uint32) * @param isEncrypted Is input word encrypted? */ word(input?: number, isEncrypted?: boolean): number; /** * Proceed encryption/decryption process * @param data Input data * @param isIn Use input data as input word for keystream generation? */ crypt(data: number[], isIn?: boolean): number[]; /** * Rollback state (bit) * @param input Input bit * @param isEncrypted Is input bit encrypted? */ rollback_bit(input?: number, isEncrypted?: boolean): number; /** * Rollback state (byte) * @param input Input byte * @param isEncrypted Is input byte encrypted? */ rollback_byte(input?: number, isEncrypted?: boolean): number; /** * Rollback state (word) * @param input Input word (uint32) * @param isEncrypted Is input word encrypted? */ rollback_word(input?: number, isEncrypted?: boolean): number; } export * from "./crapto1.js"; export * from "./utils.js";