mirror of
https://github.com/openpgpjs/openpgpjs.git
synced 2025-06-10 16:16:45 +00:00
util.readNumber: stop overflowing until full range of uint32 | #497
This commit is contained in:
parent
7b7c1b08fe
commit
ce9dee9370
@ -85,12 +85,9 @@ export default {
|
||||
|
||||
readNumber: function (bytes) {
|
||||
var n = 0;
|
||||
|
||||
for (var i = 0; i < bytes.length; i++) {
|
||||
n <<= 8;
|
||||
n += bytes[i];
|
||||
n += Math.pow(256, i) * bytes[bytes.length - 1 - i];
|
||||
}
|
||||
|
||||
return n;
|
||||
},
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user