master
1/***************************************************************************
2 * _ _ ____ _
3 * Project ___| | | | _ \| |
4 * / __| | | | |_) | |
5 * | (__| |_| | _ <| |___
6 * \___|\___/|_| \_\_____|
7 *
8 * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9 * Copyright (C) Evgeny Grin (Karlson2k), <k2k@narod.ru>.
10 *
11 * This software is licensed as described in the file COPYING, which
12 * you should have received as part of this distribution. The terms
13 * are also available at https://curl.se/docs/copyright.html.
14 *
15 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
16 * copies of the Software, and permit persons to whom the Software is
17 * furnished to do so, under the terms of the COPYING file.
18 *
19 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20 * KIND, either express or implied.
21 *
22 * SPDX-License-Identifier: curl
23 *
24 ***************************************************************************/
25#include "unitcheck.h"
26#include "curl_sha512_256.h"
28static CURLcode test_unit1615(const char *arg)
29{
30 UNITTEST_BEGIN_SIMPLE
32#ifdef CURL_HAVE_SHA512_256
34 static const char test_str1[] = "1";
35 static const unsigned char precomp_hash1[CURL_SHA512_256_DIGEST_LENGTH] = {
36 0x18, 0xd2, 0x75, 0x66, 0xbd, 0x1a, 0xc6, 0x6b, 0x23, 0x32, 0xd8,
37 0xc5, 0x4a, 0xd4, 0x3f, 0x7b, 0xb2, 0x20, 0x79, 0xc9, 0x06, 0xd0,
38 0x5f, 0x49, 0x1f, 0x3f, 0x07, 0xa2, 0x8d, 0x5c, 0x69, 0x90
39 };
40 static const char test_str2[] = "hello-you-fool";
41 static const unsigned char precomp_hash2[CURL_SHA512_256_DIGEST_LENGTH] = {
42 0xaf, 0x6f, 0xb4, 0xb0, 0x13, 0x9b, 0xee, 0x13, 0xd1, 0x95, 0x3c,
43 0xb8, 0xc7, 0xcd, 0x5b, 0x19, 0xf9, 0xcd, 0xcd, 0x21, 0xef, 0xdf,
44 0xa7, 0x42, 0x5c, 0x07, 0x13, 0xea, 0xcc, 0x1a, 0x39, 0x76
45 };
46 static const char test_str3[] = "abc";
47 static const unsigned char precomp_hash3[CURL_SHA512_256_DIGEST_LENGTH] = {
48 0x53, 0x04, 0x8E, 0x26, 0x81, 0x94, 0x1E, 0xF9, 0x9B, 0x2E, 0x29,
49 0xB7, 0x6B, 0x4C, 0x7D, 0xAB, 0xE4, 0xC2, 0xD0, 0xC6, 0x34, 0xFC,
50 0x6D, 0x46, 0xE0, 0xE2, 0xF1, 0x31, 0x07, 0xE7, 0xAF, 0x23
51 };
52 static const char test_str4[] = ""; /* empty, zero size input */
53 static const unsigned char precomp_hash4[CURL_SHA512_256_DIGEST_LENGTH] = {
54 0xc6, 0x72, 0xb8, 0xd1, 0xef, 0x56, 0xed, 0x28, 0xab, 0x87, 0xc3,
55 0x62, 0x2c, 0x51, 0x14, 0x06, 0x9b, 0xdd, 0x3a, 0xd7, 0xb8, 0xf9,
56 0x73, 0x74, 0x98, 0xd0, 0xc0, 0x1e, 0xce, 0xf0, 0x96, 0x7a
57 };
58 static const char test_str5[] =
59 "abcdefghijklmnopqrstuvwxyzzyxwvutsrqponMLKJIHGFEDCBA"
60 "abcdefghijklmnopqrstuvwxyzzyxwvutsrqponMLKJIHGFEDCBA";
61 static const unsigned char precomp_hash5[CURL_SHA512_256_DIGEST_LENGTH] = {
62 0xad, 0xe9, 0x5d, 0x55, 0x3b, 0x9e, 0x45, 0x69, 0xdb, 0x53, 0xa4,
63 0x04, 0x92, 0xe7, 0x87, 0x94, 0xff, 0xc9, 0x98, 0x5f, 0x93, 0x03,
64 0x86, 0x45, 0xe1, 0x97, 0x17, 0x72, 0x7c, 0xbc, 0x31, 0x15
65 };
66 static const char test_str6[] =
67 "/long/long/long/long/long/long/long/long/long/long/long"
68 "/long/long/long/long/long/long/long/long/long/long/long"
69 "/long/long/long/long/long/long/long/long/long/long/long"
70 "/long/long/long/long/long/long/long/long/long/long/long"
71 "/long/long/long/long/long/long/long/long/long/long/long"
72 "/long/long/long/long/long/long/long/long/long/long/long"
73 "/long/long/long/long/path?with%20some=parameters";
74 static const unsigned char precomp_hash6[CURL_SHA512_256_DIGEST_LENGTH] = {
75 0xbc, 0xab, 0xc6, 0x2c, 0x0a, 0x22, 0xd5, 0xcb, 0xac, 0xac, 0xe9,
76 0x25, 0xcf, 0xce, 0xaa, 0xaf, 0x0e, 0xa1, 0xed, 0x42, 0x46, 0x8a,
77 0xe2, 0x01, 0xee, 0x2f, 0xdb, 0x39, 0x75, 0x47, 0x73, 0xf1
78 };
79 static const char test_str7[] = "Simple string.";
80 static const unsigned char precomp_hash7[CURL_SHA512_256_DIGEST_LENGTH] = {
81 0xde, 0xcb, 0x3c, 0x81, 0x65, 0x4b, 0xa0, 0xf5, 0xf0, 0x45, 0x6b,
82 0x7e, 0x61, 0xf5, 0x0d, 0xf5, 0x38, 0xa4, 0xfc, 0xb1, 0x8a, 0x95,
83 0xff, 0x59, 0xbc, 0x04, 0x82, 0xcf, 0x23, 0xb2, 0x32, 0x56
84 };
85 static const unsigned char test_seq8[] = {
86 255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, 242, 241,
87 240, 239, 238, 237, 236, 235, 234, 233, 232, 231, 230, 229, 228, 227, 226,
88 225, 224, 223, 222, 221, 220, 219, 218, 217, 216, 215, 214, 213, 212, 211,
89 210, 209, 208, 207, 206, 205, 204, 203, 202, 201, 200, 199, 198, 197, 196,
90 195, 194, 193, 192, 191, 190, 189, 188, 187, 186, 185, 184, 183, 182, 181,
91 180, 179, 178, 177, 176, 175, 174, 173, 172, 171, 170, 169, 168, 167, 166,
92 165, 164, 163, 162, 161, 160, 159, 158, 157, 156, 155, 154, 153, 152, 151,
93 150, 149, 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, 136,
94 135, 134, 133, 132, 131, 130, 129, 128, 127, 126, 125, 124, 123, 122, 121,
95 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106,
96 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91,
97 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76,
98 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61,
99 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46,
100 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31,
101 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16,
102 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1
103 }; /* 255..1 sequence */
104 static const unsigned char precomp_hash8[CURL_SHA512_256_DIGEST_LENGTH] = {
105 0x22, 0x31, 0xf2, 0xa1, 0xb4, 0x89, 0xb2, 0x44, 0xf7, 0x66, 0xa0,
106 0xb8, 0x31, 0xed, 0xb7, 0x73, 0x8a, 0x34, 0xdc, 0x11, 0xc8, 0x2c,
107 0xf2, 0xb5, 0x88, 0x60, 0x39, 0x6b, 0x5c, 0x06, 0x70, 0x37
108 };
110 unsigned char output_buf[CURL_SHA512_256_DIGEST_LENGTH];
112 Curl_sha512_256it(output_buf, (const unsigned char *)test_str1,
113 CURL_ARRAYSIZE(test_str1) - 1);
114 verify_memory(output_buf, precomp_hash1, CURL_SHA512_256_DIGEST_LENGTH);
116 Curl_sha512_256it(output_buf, (const unsigned char *)test_str2,
117 CURL_ARRAYSIZE(test_str2) - 1);
118 verify_memory(output_buf, precomp_hash2, CURL_SHA512_256_DIGEST_LENGTH);
120 Curl_sha512_256it(output_buf, (const unsigned char *)test_str3,
121 CURL_ARRAYSIZE(test_str3) - 1);
122 verify_memory(output_buf, precomp_hash3, CURL_SHA512_256_DIGEST_LENGTH);
124 Curl_sha512_256it(output_buf, (const unsigned char *)test_str4,
125 CURL_ARRAYSIZE(test_str4) - 1);
126 verify_memory(output_buf, precomp_hash4, CURL_SHA512_256_DIGEST_LENGTH);
128 Curl_sha512_256it(output_buf, (const unsigned char *)test_str5,
129 CURL_ARRAYSIZE(test_str5) - 1);
130 verify_memory(output_buf, precomp_hash5, CURL_SHA512_256_DIGEST_LENGTH);
132 Curl_sha512_256it(output_buf, (const unsigned char *)test_str6,
133 CURL_ARRAYSIZE(test_str6) - 1);
134 verify_memory(output_buf, precomp_hash6, CURL_SHA512_256_DIGEST_LENGTH);
136 Curl_sha512_256it(output_buf, (const unsigned char *)test_str7,
137 CURL_ARRAYSIZE(test_str7) - 1);
138 verify_memory(output_buf, precomp_hash7, CURL_SHA512_256_DIGEST_LENGTH);
140 Curl_sha512_256it(output_buf, test_seq8,
141 CURL_ARRAYSIZE(test_seq8));
142 verify_memory(output_buf, precomp_hash8, CURL_SHA512_256_DIGEST_LENGTH);
144#endif /* CURL_HAVE_SHA512_256 */
146 UNITTEST_END_SIMPLE
147}
Diagnostics4 git calls · 25 ms
CallStatusSizeTime025 ms
discover200152 B3 ms
git.upload-pack discover http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=3 git.response.bytes=152 git.server.agent=gitty/1.0 git.server.object_format=sha1 git.server.caps=agent ls-refs fetch object-format git.server.fetch=shallow filter sideband-all git.protocol.version=2 git.pkt.frames=8 git.pkt.data=6 git.pkt.flush=2 git.pkt.delim=0 git.pkt.bytes=152 git.pkt.payload.max=34
ls-refs200149 B · hit3 ms
git.upload-pack ls-refs http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=3 git.response.bytes=149 git.response.cache=HIT git.response.duration_ms=3 git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=149 git.pkt.payload.max=78 git.ls_refs.count=2 git.ls_refs.head=refs/heads/master
fetchblob:none · deepen 10200287 KiB · hit3 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=19 git.response.bytes=293470 git.response.cache=HIT git.response.duration_ms=3 git.fetch.filter=blob:none git.fetch.filter.requested=tree:0 git.fetch.filter.fallback=blob:none git.fetch.filter.learned=false git.fetch.wants=31c911efe5652725e930f4d2e60c9060e5f6646d git.fetch.haves.count=0 git.fetch.deepen=10 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=10 git.pkt.data=8 git.pkt.flush=1 git.pkt.delim=1 git.pkt.bytes=293470 git.pkt.payload.max=65516 git.sideband.band1.bytes=293354 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=87 git.pack.bytes=293354 git.pack.ofs_delta=0 git.pack.ref_delta=1 git.pack.chain.max=1 git.pack.trailer=6a646bcda6740bab42e321b51998b52ea15146c0 git.pack.full=86Open pack map
fetch2002.4 KiB · hit19 ms
git.upload-pack fetch http.response.status_code=200 git.response.bytes=2452 git.response.cache=HIT git.response.duration_ms=19 git.fetch.wants=705ef392f1bb9c00c717b854521b1f73b048febc git.fetch.haves.count=0 git.fetch.deepen=0 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=2452 git.pkt.payload.max=2431 git.sideband.band1.bytes=2430 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0
Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.
- Remote
- https://5ad2236b39de4c8bd8f6270ea63f3ea9.artifacts.cloudflare.net/git/public-v0/curl.git
- Ref
- refs/heads/master
- Commit
- 31c911efe5652725e930f4d2e60c9060e5f6646d
- cf-ray
- a5e2ea1f8aad4bc2
- Request
- 6c2a1c6c…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format