Changeset 51838 in vbox for trunk/include
- Timestamp:
- Jul 3, 2014 11:05:50 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/sha.h
r51828 r51838 154 154 { 155 155 uint64_t u64BetterAlignment; 156 uint8_t abPadding[ ARCH_BITS == 32 ? 112 : 160];156 uint8_t abPadding[8 + (8 + 80) * 4]; 157 157 #ifdef RT_SHA256_PRIVATE_CONTEXT 158 158 SHA256_CTX Private; 159 #endif 160 #ifdef RT_SHA256_PRIVATE_ALT_CONTEXT 161 RTSHA256ALTPRIVATECTX AltPrivate; 159 162 #endif 160 163 } RTSHA256CONTEXT; … … 247 250 */ 248 251 RTR3DECL(int) RTSha256DigestFromFile(const char *pszFile, char **ppszDigest, PFNRTPROGRESS pfnProgressCallback, void *pvUser); 252 253 254 /** The size of a SHA-224 hash. */ 255 #define RTSHA224_HASH_SIZE 28 256 /** The length of a SHA-224 digest string. The terminator is not included. */ 257 #define RTSHA224_DIGEST_LEN 56 258 259 /** SHA-224 context (same as for SHA-256). */ 260 typedef RTSHA256CONTEXT RTSHA224CONTEXT; 261 /** Pointer to an SHA-224 context. */ 262 typedef RTSHA256CONTEXT *PRTSHA224CONTEXT; 263 264 /** 265 * Compute the SHA-224 hash of the data. 266 * 267 * @param pvBuf Pointer to the data. 268 * @param cbBuf The amount of data (in bytes). 269 * @param pabDigest Where to store the hash. (What is passed is a pointer to 270 * the caller's buffer.) 271 */ 272 RTDECL(void) RTSha224(const void *pvBuf, size_t cbBuf, uint8_t pabDigest[RTSHA224_HASH_SIZE]); 273 274 /** 275 * Initializes the SHA-224 context. 276 * 277 * @param pCtx Pointer to the SHA-224 context. 278 */ 279 RTDECL(void) RTSha224Init(PRTSHA224CONTEXT pCtx); 280 281 /** 282 * Feed data into the SHA-224 computation. 283 * 284 * @param pCtx Pointer to the SHA-224 context. 285 * @param pvBuf Pointer to the data. 286 * @param cbBuf The length of the data (in bytes). 287 */ 288 RTDECL(void) RTSha224Update(PRTSHA224CONTEXT pCtx, const void *pvBuf, size_t cbBuf); 289 290 /** 291 * Compute the SHA-224 hash of the data. 292 * 293 * @param pCtx Pointer to the SHA-224 context. 294 * @param pabDigest Where to store the hash. (What is passed is a pointer to 295 * the caller's buffer.) 296 */ 297 RTDECL(void) RTSha224Final(PRTSHA224CONTEXT pCtx, uint8_t pabDigest[RTSHA224_HASH_SIZE]); 298 299 /** 300 * Converts a SHA-224 hash to a digest string. 301 * 302 * @returns IPRT status code. 303 * 304 * @param pabDigest The binary digest returned by RTSha224Final or RTSha224. 305 * @param pszDigest Where to return the stringified digest. 306 * @param cchDigest The size of the output buffer. Should be at least 307 * RTSHA224_DIGEST_LEN + 1 bytes. 308 */ 309 RTDECL(int) RTSha224ToString(uint8_t const pabDigest[RTSHA224_HASH_SIZE], char *pszDigest, size_t cchDigest); 310 311 /** 312 * Converts a SHA-224 hash to a digest string. 313 * 314 * @returns IPRT status code. 315 * 316 * @param pszDigest The stringified digest. Leading and trailing spaces are 317 * ignored. 318 * @param pabDigest Where to store the hash. (What is passed is a pointer to 319 * the caller's buffer.) 320 */ 321 RTDECL(int) RTSha224FromString(char const *pszDigest, uint8_t pabDigest[RTSHA224_HASH_SIZE]); 322 323 /** 324 * Creates a SHA224 digest for the given memory buffer. 325 * 326 * @returns iprt status code. 327 * 328 * @param pvBuf Memory buffer to create a SHA224 digest for. 329 * @param cbBuf The amount of data (in bytes). 330 * @param ppszDigest On success the SHA224 digest. 331 * @param pfnProgressCallback optional callback for the progress indication 332 * @param pvUser user defined pointer for the callback 333 */ 334 RTR3DECL(int) RTSha224Digest(void* pvBuf, size_t cbBuf, char **ppszDigest, PFNRTPROGRESS pfnProgressCallback, void *pvUser); 335 336 /** 337 * Creates a SHA224 digest for the given file. 338 * 339 * @returns iprt status code. 340 * 341 * @param pszFile Filename to create a SHA224 digest for. 342 * @param ppszDigest On success the SHA224 digest. 343 * @param pfnProgressCallback optional callback for the progress indication 344 * @param pvUser user defined pointer for the callback 345 */ 346 RTR3DECL(int) RTSha224DigestFromFile(const char *pszFile, char **ppszDigest, PFNRTPROGRESS pfnProgressCallback, void *pvUser); 347 249 348 250 349 /** The size of a SHA-512 hash. */
Note:
See TracChangeset
for help on using the changeset viewer.