// Time bytes
let time : Nat64 = Nat64.fromIntWrap(Time.now());
let buf = Buffer.Buffer<Nat8>(8);
for (i in Iter.range(0, 7)) {
let b = Nat64.fromNat(i*8);
let n = Nat8.fromNat(Nat64.toNat((time << b) & 255));
buf.add(n);
};
dig.write(buf.toArray());
slightly better, but all the conversions are crazy and took me a while to figure out
yes! I guess- I’ll trust your judgement but I just dont like writing code like that with multiple conversion functions.
Sorry, probably ignore this I realised when I wrote this I understood less about motoko than I do now. The main thing was that Nat >> Nat didn’t work and Nat8 >> Nat8 did . Wasn’t clear.