Changeset 51841 in vbox for trunk/include
- Timestamp:
- Jul 3, 2014 11:58:27 AM (11 years ago)
- Location:
- trunk/include/iprt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/mangling.h
r51840 r51841 1336 1336 # define RTSha256Digest RT_MANGLER(RTSha256Digest) 1337 1337 # define RTSha256DigestFromFile RT_MANGLER(RTSha256DigestFromFile) 1338 # define RTSha384 RT_MANGLER(RTSha384) 1339 # define RTSha384Final RT_MANGLER(RTSha384Final) 1340 # define RTSha384FromString RT_MANGLER(RTSha384FromString) 1341 # define RTSha384Init RT_MANGLER(RTSha384Init) 1342 # define RTSha384ToString RT_MANGLER(RTSha384ToString) 1343 # define RTSha384Update RT_MANGLER(RTSha384Update) 1338 1344 # define RTSha512 RT_MANGLER(RTSha512) 1339 1345 # define RTSha512Final RT_MANGLER(RTSha512Final) -
trunk/include/iprt/sha.h
r51838 r51841 143 143 144 144 145 145 146 /** The size of a SHA-256 hash. */ 146 147 #define RTSHA256_HASH_SIZE 32 … … 252 253 253 254 255 254 256 /** The size of a SHA-224 hash. */ 255 257 #define RTSHA224_HASH_SIZE 28 … … 347 349 348 350 351 349 352 /** The size of a SHA-512 hash. */ 350 353 #define RTSHA512_HASH_SIZE 64 … … 358 361 { 359 362 uint64_t u64BetterAlignment; 360 uint8_t abPadding[ ARCH_BITS == 32 ? 216 : 256];363 uint8_t abPadding[16 + (80 + 8) * 8]; 361 364 #ifdef RT_SHA512_PRIVATE_CONTEXT 362 365 SHA512_CTX Private; 366 #endif 367 #ifdef RT_SHA512_PRIVATE_ALT_CONTEXT 368 RTSHA512ALTPRIVATECTX AltPrivate; 363 369 #endif 364 370 } RTSHA512CONTEXT; … … 425 431 RTDECL(int) RTSha512FromString(char const *pszDigest, uint8_t pabDigest[RTSHA512_HASH_SIZE]); 426 432 433 434 435 /** The size of a SHA-384 hash. */ 436 #define RTSHA384_HASH_SIZE 48 437 /** The length of a SHA-384 digest string. The terminator is not included. */ 438 #define RTSHA384_DIGEST_LEN 96 439 440 /** SHA-384 context (same as for SHA-512). */ 441 typedef RTSHA512CONTEXT RTSHA384CONTEXT; 442 /** Pointer to an SHA-384 context. */ 443 typedef RTSHA512CONTEXT *PRTSHA384CONTEXT; 444 445 /** 446 * Compute the SHA-384 hash of the data. 447 * 448 * @param pvBuf Pointer to the data. 449 * @param cbBuf The amount of data (in bytes). 450 * @param pabDigest Where to store the hash. (What is passed is a pointer to 451 * the caller's buffer.) 452 */ 453 RTDECL(void) RTSha384(const void *pvBuf, size_t cbBuf, uint8_t pabDigest[RTSHA384_HASH_SIZE]); 454 455 /** 456 * Initializes the SHA-384 context. 457 * 458 * @param pCtx Pointer to the SHA-384 context. 459 */ 460 RTDECL(void) RTSha384Init(PRTSHA384CONTEXT pCtx); 461 462 /** 463 * Feed data into the SHA-384 computation. 464 * 465 * @param pCtx Pointer to the SHA-384 context. 466 * @param pvBuf Pointer to the data. 467 * @param cbBuf The length of the data (in bytes). 468 */ 469 RTDECL(void) RTSha384Update(PRTSHA384CONTEXT pCtx, const void *pvBuf, size_t cbBuf); 470 471 /** 472 * Compute the SHA-384 hash of the data. 473 * 474 * @param pCtx Pointer to the SHA-384 context. 475 * @param pabDigest Where to store the hash. (What is passed is a pointer to 476 * the caller's buffer.) 477 */ 478 RTDECL(void) RTSha384Final(PRTSHA384CONTEXT pCtx, uint8_t pabDigest[RTSHA384_HASH_SIZE]); 479 480 /** 481 * Converts a SHA-384 hash to a digest string. 482 * 483 * @returns IPRT status code. 484 * 485 * @param pabDigest The binary digest returned by RTSha384Final or RTSha384. 486 * @param pszDigest Where to return the stringified digest. 487 * @param cchDigest The size of the output buffer. Should be at least 488 * RTSHA384_DIGEST_LEN + 1 bytes. 489 */ 490 RTDECL(int) RTSha384ToString(uint8_t const pabDigest[RTSHA384_HASH_SIZE], char *pszDigest, size_t cchDigest); 491 492 /** 493 * Converts a SHA-384 hash to a digest string. 494 * 495 * @returns IPRT status code. 496 * 497 * @param pszDigest The stringified digest. Leading and trailing spaces are 498 * ignored. 499 * @param pabDigest Where to store the hash. (What is passed is a pointer to 500 * the caller's buffer.) 501 */ 502 RTDECL(int) RTSha384FromString(char const *pszDigest, uint8_t pabDigest[RTSHA384_HASH_SIZE]); 503 504 /** 505 * Creates a SHA384 digest for the given memory buffer. 506 * 507 * @returns iprt status code. 508 * 509 * @param pvBuf Memory buffer to create a SHA384 digest for. 510 * @param cbBuf The amount of data (in bytes). 511 * @param ppszDigest On success the SHA384 digest. 512 * @param pfnProgressCallback optional callback for the progress indication 513 * @param pvUser user defined pointer for the callback 514 */ 515 RTR3DECL(int) RTSha384Digest(void* pvBuf, size_t cbBuf, char **ppszDigest, PFNRTPROGRESS pfnProgressCallback, void *pvUser); 516 517 /** 518 * Creates a SHA384 digest for the given file. 519 * 520 * @returns iprt status code. 521 * 522 * @param pszFile Filename to create a SHA384 digest for. 523 * @param ppszDigest On success the SHA384 digest. 524 * @param pfnProgressCallback optional callback for the progress indication 525 * @param pvUser user defined pointer for the callback 526 */ 527 RTR3DECL(int) RTSha384DigestFromFile(const char *pszFile, char **ppszDigest, PFNRTPROGRESS pfnProgressCallback, void *pvUser); 528 529 530 427 531 /** @} */ 428 532 429 533 RT_C_DECLS_END 430 534 431 #endif /* ___iprt_sha1_h */432 535 #endif 536
Note:
See TracChangeset
for help on using the changeset viewer.