mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-22 16:35:14 +00:00
13 lines
275 B
JavaScript
13 lines
275 B
JavaScript
|
var BN = require('bn.js')
|
||
|
var Buffer = require('safe-buffer').Buffer
|
||
|
|
||
|
function withPublic (paddedMsg, key) {
|
||
|
return Buffer.from(paddedMsg
|
||
|
.toRed(BN.mont(key.modulus))
|
||
|
.redPow(new BN(key.publicExponent))
|
||
|
.fromRed()
|
||
|
.toArray())
|
||
|
}
|
||
|
|
||
|
module.exports = withPublic
|