open_nonce_len method
Implementation
Uint8List open_nonce_len(
Uint8List box, final int boxoff, final int boxlen, Uint8List theNonce) {
// check message
if (!(box != null &&
box.length >= (boxoff + boxlen) &&
boxlen >= boxzerobytesLength &&
theNonce != null &&
theNonce.length == nonceLength)) return null;
// cipher buffer
Uint8List c = Uint8List(boxlen + boxzerobytesLength);
// message buffer
Uint8List m = Uint8List(c.length);
for (int i = 0; i < boxlen; i++)
c[i + boxzerobytesLength] = box[i + boxoff];
if (0 !=
TweetNaclFast.crypto_secretbox_open(m, c, c.length, theNonce, _key))
return null;
// wrap byte_buf_t on m offset@zerobytesLength
///return new byte_buf_t(m, zerobytesLength, m.length-zerobytesLength);
Uint8List ret = Uint8List(m.length - zerobytesLength);
for (int i = 0; i < ret.length; i++) ret[i] = m[i + zerobytesLength];
return ret;
}