let test () =
  let cipher = chacha20_encrypt_bytes test_key test_nonce test_counter test_plaintext in
  let res = PS.print_compare true (length test_plaintext) test_ciphertext cipher in

  if res
  then begin IO.print_string "\n\nChacha20 : Success!\n"; true end
  else begin IO.print_string "\n\nChacha20: Failure :(\n"; false end
let test () =
let cipher = chacha20_encrypt_bytes test_key test_nonce test_counter test_plaintext in
let res = PS.print_compare true (length test_plaintext) test_ciphertext cipher in
if res
then
  (IO.print_string "\n\nChacha20 : Success!\n";
    true)
else
  (IO.print_string "\n\nChacha20: Failure :(\n";
    false)
Spec.Chacha20.Test.fst.checked
Spec.Chacha20.fst.checked prims.fst.checked Lib.Sequence.fsti.checked Lib.RawIntTypes.fsti.checked Lib.PrintSequence.fsti.checked Lib.IntTypes.fsti.checked Lib.ByteSequence.fsti.checked FStar.UInt8.fsti.checked FStar.Pervasives.fsti.checked FStar.Mul.fst.checked FStar.List.Tot.fst.checked FStar.IO.fst.checked
Spec.Chacha20.Test.fst
Prims.unit Prims.bool FStar.IO.print_string Lib.PrintSequence.print_compare Lib.Sequence.length Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC Spec.Chacha20.Test.test_plaintext Spec.Chacha20.Test.test_ciphertext Lib.Sequence.seq Prims.eq2 Prims.nat Spec.Chacha20.chacha20_encrypt_bytes Spec.Chacha20.Test.test_key Spec.Chacha20.Test.test_nonce Spec.Chacha20.Test.test_counter
module Spec.Chacha20.Test

open FStar.Mul
open Lib.IntTypes
open Lib.RawIntTypes
open Lib.Sequence
open Lib.ByteSequence
module PS = Lib.PrintSequence

open Spec.Chacha20

#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"

let test_plaintext : lbytes 114 =
  let l = List.Tot.map u8_from_UInt8 [
    0x4cuy; 0x61uy; 0x64uy; 0x69uy; 0x65uy; 0x73uy; 0x20uy; 0x61uy;
    0x6euy; 0x64uy; 0x20uy; 0x47uy; 0x65uy; 0x6euy; 0x74uy; 0x6cuy;
    0x65uy; 0x6duy; 0x65uy; 0x6euy; 0x20uy; 0x6fuy; 0x66uy; 0x20uy;
    0x74uy; 0x68uy; 0x65uy; 0x20uy; 0x63uy; 0x6cuy; 0x61uy; 0x73uy;
    0x73uy; 0x20uy; 0x6fuy; 0x66uy; 0x20uy; 0x27uy; 0x39uy; 0x39uy;
    0x3auy; 0x20uy; 0x49uy; 0x66uy; 0x20uy; 0x49uy; 0x20uy; 0x63uy;
    0x6fuy; 0x75uy; 0x6cuy; 0x64uy; 0x20uy; 0x6fuy; 0x66uy; 0x66uy;
    0x65uy; 0x72uy; 0x20uy; 0x79uy; 0x6fuy; 0x75uy; 0x20uy; 0x6fuy;
    0x6euy; 0x6cuy; 0x79uy; 0x20uy; 0x6fuy; 0x6euy; 0x65uy; 0x20uy;
    0x74uy; 0x69uy; 0x70uy; 0x20uy; 0x66uy; 0x6fuy; 0x72uy; 0x20uy;
    0x74uy; 0x68uy; 0x65uy; 0x20uy; 0x66uy; 0x75uy; 0x74uy; 0x75uy;
    0x72uy; 0x65uy; 0x2cuy; 0x20uy; 0x73uy; 0x75uy; 0x6euy; 0x73uy;
    0x63uy; 0x72uy; 0x65uy; 0x65uy; 0x6euy; 0x20uy; 0x77uy; 0x6fuy;
    0x75uy; 0x6cuy; 0x64uy; 0x20uy; 0x62uy; 0x65uy; 0x20uy; 0x69uy;
    0x74uy; 0x2euy
  ] in
  assert_norm (List.Tot.length l == 114);
  of_list l


let test_ciphertext : lbytes 114 =
  let l = List.Tot.map u8_from_UInt8 [
    0x6euy; 0x2euy; 0x35uy; 0x9auy; 0x25uy; 0x68uy; 0xf9uy; 0x80uy;
    0x41uy; 0xbauy; 0x07uy; 0x28uy; 0xdduy; 0x0duy; 0x69uy; 0x81uy;
    0xe9uy; 0x7euy; 0x7auy; 0xecuy; 0x1duy; 0x43uy; 0x60uy; 0xc2uy;
    0x0auy; 0x27uy; 0xafuy; 0xccuy; 0xfduy; 0x9fuy; 0xaeuy; 0x0buy;
    0xf9uy; 0x1buy; 0x65uy; 0xc5uy; 0x52uy; 0x47uy; 0x33uy; 0xabuy;
    0x8fuy; 0x59uy; 0x3duy; 0xabuy; 0xcduy; 0x62uy; 0xb3uy; 0x57uy;
    0x16uy; 0x39uy; 0xd6uy; 0x24uy; 0xe6uy; 0x51uy; 0x52uy; 0xabuy;
    0x8fuy; 0x53uy; 0x0cuy; 0x35uy; 0x9fuy; 0x08uy; 0x61uy; 0xd8uy;
    0x07uy; 0xcauy; 0x0duy; 0xbfuy; 0x50uy; 0x0duy; 0x6auy; 0x61uy;
    0x56uy; 0xa3uy; 0x8euy; 0x08uy; 0x8auy; 0x22uy; 0xb6uy; 0x5euy;
    0x52uy; 0xbcuy; 0x51uy; 0x4duy; 0x16uy; 0xccuy; 0xf8uy; 0x06uy;
    0x81uy; 0x8cuy; 0xe9uy; 0x1auy; 0xb7uy; 0x79uy; 0x37uy; 0x36uy;
    0x5auy; 0xf9uy; 0x0buy; 0xbfuy; 0x74uy; 0xa3uy; 0x5buy; 0xe6uy;
    0xb4uy; 0x0buy; 0x8euy; 0xeduy; 0xf2uy; 0x78uy; 0x5euy; 0x42uy;
    0x87uy; 0x4duy
  ] in
  assert_norm (List.Tot.length l == 114);
  of_list l


let test_key : lbytes 32 =
  let l = List.Tot.map u8_from_UInt8 [
    0uy;   1uy;  2uy;  3uy;  4uy;  5uy;  6uy;  7uy;
    8uy;   9uy; 10uy; 11uy; 12uy; 13uy; 14uy; 15uy;
    16uy; 17uy; 18uy; 19uy; 20uy; 21uy; 22uy; 23uy;
    24uy; 25uy; 26uy; 27uy; 28uy; 29uy; 30uy; 31uy
  ] in
  assert_norm (List.Tot.length l == 32);
  of_list l


let test_nonce : lbytes 12 =
  let l = List.Tot.map u8_from_UInt8 [
    0uy; 0uy; 0uy; 0uy; 0uy; 0uy; 0uy; 0x4auy; 0uy; 0uy; 0uy; 0uy
  ] in
  assert_norm (List.Tot.length l == 12);
  of_list l


let test_counter = 1
val test : _: Prims.unit -> FStar.All.ALL Prims.bool
_: Prims.unit -> FStar.All.ALL Prims.bool