Skip to content

Commit

Permalink
Tidy formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewJohnHeath committed Sep 11, 2024
1 parent 1fe6436 commit 9839326
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions crates/compiler/builtins/roc/Crypt.roc
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,18 @@ sha256Digest : Sha256 -> Digest256

hashSha256 : List U8 -> Digest256
hashSha256 = \bytes ->
sha256Digest (sha256AddBytes (emptySha256 {}) bytes)
{} |> emptySha256
|> sha256AddBytes bytes
|> sha256Digest

u128Bytes : U128 -> List U8
u128Bytes = \number ->
loop = \ n, bytes, place ->
if place == 16 then bytes
else
newByte = n |> Num.bitwiseAnd 255 |> Num.toU8
newByte = n
|> Num.bitwiseAnd 255
|> Num.toU8
loop (Num.shiftRightBy n 8) (List.prepend bytes newByte) (place + 1)
loop number [] 0

Expand Down

0 comments on commit 9839326

Please sign in to comment.