/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #include #include #include #include static const char *digest_in_MD[] = { "", "a", "abc", "message digest", "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", "12345678901234567890123456789012345678901234567890123456789012345678901234567890", NULL, }; static const char *digest_out_MD2[]= { "8350e5a3e24c153df2275c9f80692773", "32ec01ec4a6dac72c0ab96fb34c0b5d1", "da853b0d3f88d99b30283a69e6ded6bb", "ab4f496bfb2a530b219ff33031fe06b0", "4e8ddff3650292ab5a4108c3aa47940b", "da33def2a42df13975352846c30338cd", "d5976f79d83d3a0dc9806c3c66f3efd8", }; static const char *digest_out_MD5[]= { "d41d8cd98f00b204e9800998ecf8427e", "0cc175b9c0f1b6a831c399e269772661", "900150983cd24fb0d6963f7d28e17f72", "f96b697d7cb7938d525a2f31aaf161d0", "c3fcd3d76192e4007dfb496cca67e13b", "d174ab98d277d9f5a5611c2c9f419d9f", "57edf4a22be3c955ac49da2e2107b67a", }; static const char *digest_in_SHA[]= { "abc", "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", NULL, }; static const char *digest_out_SHA_0[]= { "0164b8a914cd2a5e74c4f7ff082c4d97f1edf880", "d2516ee1acfa5baf33dfc1c471e438449ef134c8", }; static const char *digest_out_SHA_1[]= { "a9993e364706816aba3e25717850c26c9cd0d89d", "84983e441c3bd26ebaae4aa1f95129e5e54670f1", }; static const char *digest_bigout_SHA_0= "3232affa48628a26653b5aaa44541fd90d690603"; static const char *digest_bigout_SHA_1= "34aa973cd4c4daa4f61eeb2bdbad27316534016f"; static const char digest_key_HMAC_MD5_1[] = { 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x00 }; static const char digest_key_HMAC_MD5_2[] = { /* "Jefe" */ 'J', 'e', 'f', 'e', 0x00 }; static const unsigned char digest_key_HMAC_MD5_3[] = { 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0x00 }; static const char *digest_key_HMAC_MD5[] = { (const char*)&digest_key_HMAC_MD5_1, (const char*)&digest_key_HMAC_MD5_2, /* "Jefe", */ (const char*)&digest_key_HMAC_MD5_3, NULL }; static const unsigned char digest_in_HMAC_MD5_3[] = { 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0x00 }; static const char *digest_in_HMAC_MD5[] = { "Hi There", "what do ya want for nothing?", (const char*)&digest_in_HMAC_MD5_3, NULL }; static const char *digest_out_HMAC_MD5[] = { "9294727a3638bb1c13f48ef8158bfc9d", "750c783e6ab0b503eaa86e310a5db738", "56be34521d144c88dbb8c733f0e8b3f6", NULL }; static const char *digest_out_HMAC_SHA1[] = { /* unofficial, i.e. not verified */ "675b0b3a1b4ddf4e124872da6c2f632bfed957e9", "effcdf6ae5eb2fa2d27416d5f184df9c259a7c79", "d730594d167e35d5956fd8003d0db3d3f46dc7bb", NULL }; static char *pt (unsigned char *md, int length) { int i; static char buf[80]; for (i=0; i