public static string ToHex(this ICryptoolStream stream) { if (stream == null) { return(""); } return(stream.ToByteArray().ToHex()); }
// convert stream to ulong private ulong stream2ulong(ICryptoolStream s) { byte[] tmpbuf = s.ToByteArray(); Array.Reverse(tmpbuf); byte[] buf = new byte[8]; for (int i = 0; i < 8; i++) { buf[i] = 0; } for (int i = 0; i < tmpbuf.Length; i++) { buf[i] = tmpbuf[i]; } return(BitConverter.ToUInt64(buf, 0)); }