test-helpers.d.ts 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /// <reference types="node" />
  2. export declare const hello48: Buffer;
  3. export declare const inputs: {
  4. large: {
  5. input: string;
  6. hash: Buffer;
  7. };
  8. hello: {
  9. input: string;
  10. hash: Buffer;
  11. };
  12. goodbye: {
  13. input: string;
  14. hash: Buffer;
  15. };
  16. };
  17. /**
  18. * Test vectors from the BLAKE3 repo.
  19. *
  20. * > Each test is an input length and three outputs, one for each of the hash,
  21. * > keyedHash, and deriveKey modes. The input in each case is filled with a
  22. * > 251-byte-long repeating pattern: 0, 1, 2, ..., 249, 250, 0, 1, ... The
  23. * > key used with keyedHash is the 32-byte ASCII string given in the 'key'
  24. * > field below. For deriveKey, the test input is used as the input key, and
  25. * > the context string is 'BLAKE3 2019-12-27 6:29:52 example context'.
  26. * > (As good practice for following the security requirements of deriveKey,
  27. * > test runners should make that context string a hardcoded constant, and we
  28. * > do not provided it in machine-readable form.) Outputs are encoded as
  29. * > hexadecimal. Each case is an extended output, and implementations should
  30. * > also check that the first 32 bytes match their default-length output.
  31. */
  32. export declare const ogTestVectors: {
  33. key: string;
  34. context: string;
  35. cases: {
  36. inputLen: number;
  37. expectedHash: string;
  38. expectedKeyed: string;
  39. expectedDerive: string;
  40. }[];
  41. };