How to use the fromBuffer function from bn.js

Find comprehensive JavaScript bn.js.fromBuffer code examples handpicked from public code repositorys.

52
53
54
55
56
57
58
59
60
61
  buf = reversebuf(buf);
}

if (buf[0] & 0x80) {
  buf[0] = buf[0] & 0x7f;
  ret = BN.fromBuffer(buf);
  ret.neg().copy(ret);
} else {
  ret = BN.fromBuffer(buf);
}
fork icon0
star icon3
watch icon3

+ 5 other calls in file

39
40
41
42
43
44
45
46
47
48
49
 * (a buffer where the most significant bit represents the sign (0 = positive, -1 = negative))
 */
BN.fromSM = function(buf, opts) {
  var ret;
  if (buf.length === 0) {
    return BN.fromBuffer(Buffer.from([0]));
  }


  var endian = 'big';
  if (opts) {
fork icon1
star icon2
watch icon2

+ 5 other calls in file