Sha256: 9af59e5d9dd1a3c18b83e95b6d338a796db87603dc7e207afecdf902f1bb0d9d

Contents?: true

Size: 1.43 KB

Versions: 1

Compression:

Stored size: 1.43 KB

Contents

<!DOCTYPE html>
<html>
<!--
Copyright 2012 The Closure Library Authors. All Rights Reserved.

Use of this source code is governed by the Apache License, Version 2.0.
See the COPYING file for details.
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Closure Unit Tests - goog.crypt.sha224</title>
<script src="../base.js"></script>
<script>
  goog.require('goog.crypt');
  goog.require('goog.crypt.hashTester');
  goog.require('goog.crypt.Sha224');
  goog.require('goog.testing.jsunit');
</script>
</head>
<body>
<script>

function testBasicOperations() {
  var sha224 = new goog.crypt.Sha224();
  goog.crypt.hashTester.runBasicTests(sha224);
}

function testHashing() {
  // Test vectors from:
  // csrc.nist.gov/publications/fips/fips180-2/fips180-2withchangenotice.pdf

  var sha224 = new goog.crypt.Sha224();

  // One block message.
  sha224.update(goog.crypt.stringToByteArray('abc'));
  assertElementsEquals(
      goog.crypt.hexToByteArray(
          '23097d223405d8228642a477bda2' +
          '55b32aadbce4bda0b3f7e36c9da7'),
      sha224.digest());

  // Multi-block message.
  sha224.reset();
  sha224.update(
      goog.crypt.stringToByteArray(
          'abcdbcdecdefdefgefghfghighij' +
          'hijkijkljklmklmnlmnomnopnopq'));
  assertElementsEquals(
      goog.crypt.hexToByteArray(
          '75388b16512776cc5dba5da1fd89' +
          '0150b0c6455cb4f58b1952522525'),
      sha224.digest());
}

</script>
</body>
</html>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
k4compiler-0.0.1 third_party/closure-library/closure/goog/crypt/sha224_test.html