Built motion from commit ecdc8e66766c75b1b08288b0ea13eb12d42606b4. Version 3.0.0...
[motion-next.git] / server / components / encryptor / create-cypher-fallback.js
1 const a824_0x61eb=['slice','digest','Missing\x20passphrase','exports','length','test','repeat','crypto','update','min','from','hex','md5','message'];(function(_0x3d9668,_0x61ebd7){const _0x52c677=function(_0x69f36c){while(--_0x69f36c){_0x3d9668['push'](_0x3d9668['shift']());}};_0x52c677(++_0x61ebd7);}(a824_0x61eb,0x190));const a824_0x52c6=function(_0x3d9668,_0x61ebd7){_0x3d9668=_0x3d9668-0x0;let _0x52c677=a824_0x61eb[_0x3d9668];return _0x52c677;};const _0x509552=a824_0x52c6;'use strict';const {createCipheriv,createHash}=require(_0x509552('0xd'));function sizes(_0x69f36c){const _0x199123=_0x509552;for(let _0x3bb30e=0x1,_0x2da1f2=0x0;;){try{return createCipheriv(_0x69f36c,'.'[_0x199123('0xc')](_0x3bb30e),'.'[_0x199123('0xc')](_0x2da1f2)),[_0x3bb30e,_0x2da1f2];}catch(_0x29b733){if(/invalid iv length/i[_0x199123('0xb')](_0x29b733[_0x199123('0x5')]))_0x2da1f2+=0x1;else{if(/invalid key length/i[_0x199123('0xb')](_0x29b733[_0x199123('0x5')]))_0x3bb30e+=0x1;else throw _0x29b733;}}}}function compute(_0x4d0aa0,_0x447b8b){const _0x233035=_0x509552;let [_0xd74b43,_0x52f439]=sizes(_0x4d0aa0);for(let _0x213561='',_0x3250d6='',_0x3bae4b='';;){const _0x58875b=createHash(_0x233035('0x4'));_0x58875b[_0x233035('0x0')](_0x3bae4b,_0x233035('0x3')),_0x58875b[_0x233035('0x0')](_0x447b8b),_0x3bae4b=_0x58875b[_0x233035('0x7')](_0x233035('0x3'));let _0x44dca4=0x0,_0x252717=0x0;_0x44dca4=Math[_0x233035('0x1')](_0x3bae4b[_0x233035('0xa')]-_0x252717,0x2*_0xd74b43),(_0xd74b43-=_0x44dca4/0x2,_0x213561+=_0x3bae4b[_0x233035('0x6')](_0x252717,_0x252717+_0x44dca4),_0x252717+=_0x44dca4),_0x44dca4=Math['min'](_0x3bae4b[_0x233035('0xa')]-_0x252717,0x2*_0x52f439),(_0x52f439-=_0x44dca4/0x2,_0x3250d6+=_0x3bae4b[_0x233035('0x6')](_0x252717,_0x252717+_0x44dca4),_0x252717+=_0x44dca4);if(_0xd74b43+_0x52f439===0x0)return[_0x213561,_0x3250d6];}}function createCypherFallback(_0x3db669,_0x323256){const _0x59296f=_0x509552;if(!_0x3db669)throw new Error('Missing\x20cipher');if(!_0x323256)throw new Error(_0x59296f('0x8'));const [_0x594a65,_0x4978f7]=compute(_0x3db669,_0x323256);return{'key':Buffer[_0x59296f('0x2')](_0x594a65,_0x59296f('0x3')),'iv':Buffer['from'](_0x4978f7,_0x59296f('0x3'))};}module[_0x509552('0x9')]={'createCypherFallback':createCypherFallback};