Built motion from commit f651e4b0a7312c0adceb5e57d6684a801a3aaf0d. Version 3.0.0...
[motion-next.git] / server / components / encryptor / create-cypher-fallback.js
1 const a824_0x1532=['message','digest','crypto','hex','min','from','length','Missing\x20cipher','Missing\x20passphrase','md5','repeat','update','test'];(function(_0x53d063,_0x1532a2){const _0x4e2075=function(_0x36c92b){while(--_0x36c92b){_0x53d063['push'](_0x53d063['shift']());}};_0x4e2075(++_0x1532a2);}(a824_0x1532,0x9e));const a824_0x4e20=function(_0x53d063,_0x1532a2){_0x53d063=_0x53d063-0x0;let _0x4e2075=a824_0x1532[_0x53d063];return _0x4e2075;};const _0x372fc5=a824_0x4e20;'use strict';const {createCipheriv,createHash}=require(_0x372fc5('0x0'));function sizes(_0x36c92b){const _0x4d1c10=_0x372fc5;for(let _0xabb0fc=0x1,_0x28e4ca=0x0;;){try{return createCipheriv(_0x36c92b,'.'[_0x4d1c10('0x8')](_0xabb0fc),'.'['repeat'](_0x28e4ca)),[_0xabb0fc,_0x28e4ca];}catch(_0x1dee57){if(/invalid iv length/i[_0x4d1c10('0xa')](_0x1dee57[_0x4d1c10('0xb')]))_0x28e4ca+=0x1;else{if(/invalid key length/i[_0x4d1c10('0xa')](_0x1dee57[_0x4d1c10('0xb')]))_0xabb0fc+=0x1;else throw _0x1dee57;}}}}function compute(_0x5cd65c,_0x1fb951){const _0x1f4a13=_0x372fc5;let [_0x506779,_0x29e07e]=sizes(_0x5cd65c);for(let _0x2af141='',_0x3a5c22='',_0xf794dd='';;){const _0x1ff8a3=createHash(_0x1f4a13('0x7'));_0x1ff8a3[_0x1f4a13('0x9')](_0xf794dd,'hex'),_0x1ff8a3['update'](_0x1fb951),_0xf794dd=_0x1ff8a3[_0x1f4a13('0xc')](_0x1f4a13('0x1'));let _0x57ba00=0x0,_0x565f0f=0x0;_0x57ba00=Math[_0x1f4a13('0x2')](_0xf794dd[_0x1f4a13('0x4')]-_0x565f0f,0x2*_0x506779),(_0x506779-=_0x57ba00/0x2,_0x2af141+=_0xf794dd['slice'](_0x565f0f,_0x565f0f+_0x57ba00),_0x565f0f+=_0x57ba00),_0x57ba00=Math[_0x1f4a13('0x2')](_0xf794dd[_0x1f4a13('0x4')]-_0x565f0f,0x2*_0x29e07e),(_0x29e07e-=_0x57ba00/0x2,_0x3a5c22+=_0xf794dd['slice'](_0x565f0f,_0x565f0f+_0x57ba00),_0x565f0f+=_0x57ba00);if(_0x506779+_0x29e07e===0x0)return[_0x2af141,_0x3a5c22];}}function createCypherFallback(_0x3cb7e0,_0x225d5e){const _0x1dbc7a=_0x372fc5;if(!_0x3cb7e0)throw new Error(_0x1dbc7a('0x5'));if(!_0x225d5e)throw new Error(_0x1dbc7a('0x6'));const [_0x24d996,_0x5812ae]=compute(_0x3cb7e0,_0x225d5e);return{'key':Buffer[_0x1dbc7a('0x3')](_0x24d996,_0x1dbc7a('0x1')),'iv':Buffer[_0x1dbc7a('0x3')](_0x5812ae,_0x1dbc7a('0x1'))};}module['exports']={'createCypherFallback':createCypherFallback};