webrtc_m130/rtc_base/sha1digest.h
Joachim Bauch 820941a1fd Remove custom MD5 / SHA-1 implementations.
Use (optimized) versions from BoringSSL/OpenSSL instead.

Bug: webrtc:8677
Change-Id: I8610bb757c228ad99518ee583329eb7944c4bf08
Reviewed-on: https://webrtc-review.googlesource.com/35020
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Commit-Queue: Joachim Bauch <jbauch@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22084}
2018-02-19 15:03:35 +00:00

38 lines
955 B
C++

/*
* Copyright 2012 The WebRTC Project Authors. All rights reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef RTC_BASE_SHA1DIGEST_H_
#define RTC_BASE_SHA1DIGEST_H_
#include <openssl/sha.h>
#include "rtc_base/messagedigest.h"
namespace rtc {
// A simple wrapper for the SHA-1 implementation.
class Sha1Digest : public MessageDigest {
public:
enum { kSize = SHA_DIGEST_LENGTH };
Sha1Digest() {
SHA1_Init(&ctx_);
}
size_t Size() const override;
void Update(const void* buf, size_t len) override;
size_t Finish(void* buf, size_t len) override;
private:
SHA_CTX ctx_;
};
} // namespace rtc
#endif // RTC_BASE_SHA1DIGEST_H_