Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | 1x 1x 22x 22x 22x 22x 1x 1x 1x | import { crossEnvCrypto } from "./cross-env-crypto"; export interface PrimeGroup { N: bigint; // the prime g: bigint; // a generator of the multiplicative group Zn } export type HashFunction = (data: ArrayBuffer) => Promise<ArrayBuffer>; export class SRPParameters { public static PrimeGroup: { [key: number]: PrimeGroup }; public static H: { [key: string]: HashFunction }; public readonly NBits: number; constructor( public readonly primeGroup: PrimeGroup = SRPParameters.PrimeGroup[2048], public readonly H: HashFunction = SRPParameters.H.SHA512, ) { this.NBits = this.primeGroup.N.toString(2).length; if (!H) { throw new Error("Hash function required"); } } } SRPParameters.PrimeGroup = { 256: { N: BigInt( "125617018995153554710546479714086468244499594888726646874671447258204721048803", ), g: BigInt(2), }, 512: { N: BigInt( "11144252439149533417835749556168991736939157778924947037200268358613863350040339017097790259154750906072491181606044774215413467851989724116331597513345603", ), g: BigInt(2), }, 768: { N: BigInt( "1087179135105457859072065649059069760280540086975817629066444682366896187793570736574549981488868217843627094867924800342887096064844227836735667168319981288765377499806385489913341488724152562880918438701129530606139552645689583147", ), g: BigInt(2), }, 1024: { N: BigInt( "167609434410335061345139523764350090260135525329813904557420930309800865859473551531551523800013916573891864789934747039010546328480848979516637673776605610374669426214776197828492691384519453218253702788022233205683635831626913357154941914129985489522629902540768368409482248290641036967659389658897350067939", ), g: BigInt(2), }, 1536: { N: BigInt( "1486998185923128292816507353619409521152457662596380074614818966810244974827752411420380336514078832314731499938313197533147998565301020797040787428051479639316928015998415709101293902971072960487527411068082311763171549170528008620813391411445907584912865222076100726050255271567749213905330659264908657221124284665444825474741087704974475795505492821585749417639344967192301749033325359286273431675492866492416941152646940908101472416714421046022696100064262587", ), g: BigInt(2), }, 2048: { N: BigInt( "21766174458617435773191008891802753781907668374255538511144643224689886235383840957210909013086056401571399717235807266581649606472148410291413364152197364477180887395655483738115072677402235101762521901569820740293149529620419333266262073471054548368736039519702486226506248861060256971802984953561121442680157668000761429988222457090413873973970171927093992114751765168063614761119615476233422096442783117971236371647333871414335895773474667308967050807005509320424799678417036867928316761272274230314067548291133582479583061439577559347101961771406173684378522703483495337037655006751328447510550299250924469288819", ), g: BigInt(2), }, }; SRPParameters.H = { SHA1: crossEnvCrypto.hashFunctions.SHA1, SHA256: crossEnvCrypto.hashFunctions.SHA256, SHA384: crossEnvCrypto.hashFunctions.SHA384, SHA512: crossEnvCrypto.hashFunctions.SHA512, }; |