mirror of
https://pdfium.googlesource.com/pdfium
synced 2026-08-03 11:00:54 +08:00
Updates old-style copyright headers to the new style, by removing "All rights reserved." Also inserts "The" before "PDFium Authors", which is required by both styles. Mechanically generated by this command: PATTERN='Copyright \([0-9]\+\) \(The \)\?PDFium Authors. All rights reserved.' git grep -l "$PATTERN" \ | xargs sed "s/$PATTERN/Copyright \1 The PDFium Authors/" -i'' Fixed: pdfium:1884 Change-Id: I6f781d811df8839e2e21b85f716529b813828bcd Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/100371 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: K. Moon <kmoon@chromium.org>
26 lines
674 B
C++
26 lines
674 B
C++
// Copyright 2019 The PDFium Authors
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "testing/utils/hash.h"
|
|
|
|
#include "core/fdrm/fx_crypt.h"
|
|
|
|
std::string CryptToBase16(const uint8_t* digest) {
|
|
static char const zEncode[] = "0123456789abcdef";
|
|
std::string ret;
|
|
ret.resize(32);
|
|
for (int i = 0, j = 0; i < 16; i++, j += 2) {
|
|
uint8_t a = digest[i];
|
|
ret[j] = zEncode[(a >> 4) & 0xf];
|
|
ret[j + 1] = zEncode[a & 0xf];
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
std::string GenerateMD5Base16(pdfium::span<const uint8_t> data) {
|
|
uint8_t digest[16];
|
|
CRYPT_MD5Generate(data, digest);
|
|
return CryptToBase16(digest);
|
|
}
|