| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "../../../include/fdrm/fx_crypt.h" | 7 #include "../../../include/fdrm/fx_crypt.h" |
| 8 #ifdef __cplusplus | 8 #ifdef __cplusplus |
| 9 extern "C" { | 9 extern "C" { |
| 10 #endif | 10 #endif |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 if (i) { | 398 if (i) { |
| 399 ret <<= 4; | 399 ret <<= 4; |
| 400 } | 400 } |
| 401 if (str[i] >= '0' && str[i] <= '9') { | 401 if (str[i] >= '0' && str[i] <= '9') { |
| 402 ret |= (str[i] - '0') & 0xFF; | 402 ret |= (str[i] - '0') & 0xFF; |
| 403 } else if (str[i] >= 'a' && str[i] <= 'f') { | 403 } else if (str[i] >= 'a' && str[i] <= 'f') { |
| 404 ret |= (str[i] - 'a' + 10) & 0xFF; | 404 ret |= (str[i] - 'a' + 10) & 0xFF; |
| 405 } else if (str[i] >= 'A' && str[i] <= 'F') { | 405 } else if (str[i] >= 'A' && str[i] <= 'F') { |
| 406 ret |= (str[i] - 'A' + 10) & 0xFF; | 406 ret |= (str[i] - 'A' + 10) & 0xFF; |
| 407 } else { | 407 } else { |
| 408 FXSYS_assert(FALSE); | 408 FXSYS_assert(false); |
| 409 } | 409 } |
| 410 } | 410 } |
| 411 return ret; | 411 return ret; |
| 412 } | 412 } |
| 413 void CRYPT_SHA384Start(void* context) | 413 void CRYPT_SHA384Start(void* context) |
| 414 { | 414 { |
| 415 if (context == NULL) { | 415 if (context == NULL) { |
| 416 return; | 416 return; |
| 417 } | 417 } |
| 418 sha384_context *ctx = (sha384_context *)context; | 418 sha384_context *ctx = (sha384_context *)context; |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 void CRYPT_SHA512Generate(const uint8_t* data, FX_DWORD size, uint8_t digest[64]
) | 732 void CRYPT_SHA512Generate(const uint8_t* data, FX_DWORD size, uint8_t digest[64]
) |
| 733 { | 733 { |
| 734 sha384_context context; | 734 sha384_context context; |
| 735 CRYPT_SHA512Start(&context); | 735 CRYPT_SHA512Start(&context); |
| 736 CRYPT_SHA512Update(&context, data, size); | 736 CRYPT_SHA512Update(&context, data, size); |
| 737 CRYPT_SHA512Finish(&context, digest); | 737 CRYPT_SHA512Finish(&context, digest); |
| 738 } | 738 } |
| 739 #ifdef __cplusplus | 739 #ifdef __cplusplus |
| 740 }; | 740 }; |
| 741 #endif | 741 #endif |
| OLD | NEW |