LCOV - code coverage report
Current view: top level - shared_model/cryptography/ed25519_sha3_impl/internal - sha3_hash.cpp (source / functions) Hit Total Coverage
Test: coverage_cleared.info Lines: 17 24 70.8 %
Date: 2018-12-05 17:11:35 Functions: 6 8 75.0 %

          Line data    Source code
       1             : /**
       2             :  * Copyright Soramitsu Co., Ltd. All Rights Reserved.
       3             :  * SPDX-License-Identifier: Apache-2.0
       4             :  */
       5             : 
       6             : #include <ed25519/ed25519/sha256.h>
       7             : #include <ed25519/ed25519/sha512.h>
       8             : 
       9             : #include "cryptography/ed25519_sha3_impl/internal/sha3_hash.hpp"
      10             : 
      11             : namespace iroha {
      12             : 
      13             :   void sha3_256(uint8_t *output, const uint8_t *input, size_t in_size) {
      14       42435 :     sha256(output, input, in_size);
      15       42435 :   }
      16             : 
      17             :   void sha3_512(uint8_t *output, const uint8_t *input, size_t in_size) {
      18         204 :     sha512(output, input, in_size);
      19         204 :   }
      20             : 
      21             :   hash256_t sha3_256(const uint8_t *input, size_t in_size) {
      22         204 :     hash256_t h;
      23         204 :     sha3_256(h.data(), input, in_size);
      24         204 :     return h;
      25             :   }
      26             : 
      27             :   hash512_t sha3_512(const uint8_t *input, size_t in_size) {
      28         204 :     hash512_t h;
      29         204 :     sha3_512(h.data(), input, in_size);
      30         204 :     return h;
      31             :   }
      32             : 
      33             :   hash256_t sha3_256(const std::string &msg) {
      34        9886 :     hash256_t h;
      35        9886 :     sha3_256(
      36        9886 :         h.data(), reinterpret_cast<const uint8_t *>(msg.data()), msg.size());
      37        9886 :     return h;
      38             :   }
      39             : 
      40             :   hash512_t sha3_512(const std::string &msg) {
      41           0 :     hash512_t h;
      42           0 :     sha3_512(
      43           0 :         h.data(), reinterpret_cast<const uint8_t *>(msg.data()), msg.size());
      44           0 :     return h;
      45             :   }
      46             : 
      47             :   hash512_t sha3_512(const std::vector<uint8_t> &msg) {
      48           0 :     hash512_t h;
      49           0 :     sha3_512(h.data(), msg.data(), msg.size());
      50           0 :     return h;
      51             :   }
      52             : 
      53             :   hash256_t sha3_256(const std::vector<uint8_t> &msg) {
      54       32342 :     hash256_t h;
      55       32342 :     sha3_256(h.data(), msg.data(), msg.size());
      56       32342 :     return h;
      57             :   }
      58             : }  // namespace iroha

Generated by: LCOV version 1.13