Commit dbc4ac1c76827e954e0aa27afe8bb7e0b8993a93

Edward Thomson 2022-01-22T23:10:03

oid: `GIT_OID_*SZ` is now `GIT_OID_SHA1_*SIZE` In preparation for SHA256 support, `GIT_OID_RAWSZ` and `GIT_OID_HEXSZ` need to indicate that they're the size of _SHA1_ OIDs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
diff --git a/examples/cat-file.c b/examples/cat-file.c
index b81e9a8..741edb4 100644
--- a/examples/cat-file.c
+++ b/examples/cat-file.c
@@ -49,7 +49,7 @@ static void show_blob(const git_blob *blob)
 static void show_tree(const git_tree *tree)
 {
 	size_t i, max_i = (int)git_tree_entrycount(tree);
-	char oidstr[GIT_OID_HEXSZ + 1];
+	char oidstr[GIT_OID_SHA1_HEXSIZE + 1];
 	const git_tree_entry *te;
 
 	for (i = 0; i < max_i; ++i) {
@@ -70,7 +70,7 @@ static void show_tree(const git_tree *tree)
 static void show_commit(const git_commit *commit)
 {
 	unsigned int i, max_i;
-	char oidstr[GIT_OID_HEXSZ + 1];
+	char oidstr[GIT_OID_SHA1_HEXSIZE + 1];
 
 	git_oid_tostr(oidstr, sizeof(oidstr), git_commit_tree_id(commit));
 	printf("tree %s\n", oidstr);
@@ -90,7 +90,7 @@ static void show_commit(const git_commit *commit)
 
 static void show_tag(const git_tag *tag)
 {
-	char oidstr[GIT_OID_HEXSZ + 1];
+	char oidstr[GIT_OID_SHA1_HEXSIZE + 1];
 
 	git_oid_tostr(oidstr, sizeof(oidstr), git_tag_target_id(tag));;
 	printf("object %s\n", oidstr);
@@ -125,7 +125,7 @@ int lg2_cat_file(git_repository *repo, int argc, char *argv[])
 {
 	struct catfile_options o = { ".", NULL, 0, 0 };
 	git_object *obj = NULL;
-	char oidstr[GIT_OID_HEXSZ + 1];
+	char oidstr[GIT_OID_SHA1_HEXSIZE + 1];
 
 	parse_opts(&o, argc, argv);
 
@@ -133,7 +133,7 @@ int lg2_cat_file(git_repository *repo, int argc, char *argv[])
 			"Could not resolve", o.rev);
 
 	if (o.verbose) {
-		char oidstr[GIT_OID_HEXSZ + 1];
+		char oidstr[GIT_OID_SHA1_HEXSIZE + 1];
 		git_oid_tostr(oidstr, sizeof(oidstr), git_object_id(obj));
 
 		printf("%s %s\n--\n",
diff --git a/examples/fetch.c b/examples/fetch.c
index 2b5ed11..bbd882c 100644
--- a/examples/fetch.c
+++ b/examples/fetch.c
@@ -15,17 +15,17 @@ static int progress_cb(const char *str, int len, void *data)
  */
 static int update_cb(const char *refname, const git_oid *a, const git_oid *b, void *data)
 {
-	char a_str[GIT_OID_HEXSZ+1], b_str[GIT_OID_HEXSZ+1];
+	char a_str[GIT_OID_SHA1_HEXSIZE+1], b_str[GIT_OID_SHA1_HEXSIZE+1];
 	(void)data;
 
 	git_oid_fmt(b_str, b);
-	b_str[GIT_OID_HEXSZ] = '\0';
+	b_str[GIT_OID_SHA1_HEXSIZE] = '\0';
 
 	if (git_oid_is_zero(a)) {
 		printf("[new]     %.20s %s\n", b_str, refname);
 	} else {
 		git_oid_fmt(a_str, a);
-		a_str[GIT_OID_HEXSZ] = '\0';
+		a_str[GIT_OID_SHA1_HEXSIZE] = '\0';
 		printf("[updated] %.10s..%.10s %s\n", a_str, b_str, refname);
 	}
 
diff --git a/examples/for-each-ref.c b/examples/for-each-ref.c
index 020dab4..a070674 100644
--- a/examples/for-each-ref.c
+++ b/examples/for-each-ref.c
@@ -5,7 +5,7 @@ static int show_ref(git_reference *ref, void *data)
 {
 	git_repository *repo = data;
 	git_reference *resolved = NULL;
-	char hex[GIT_OID_HEXSZ+1];
+	char hex[GIT_OID_SHA1_HEXSIZE+1];
 	const git_oid *oid;
 	git_object *obj;
 	
@@ -16,7 +16,7 @@ static int show_ref(git_reference *ref, void *data)
 	
 	oid = git_reference_target(resolved ? resolved : ref);
 	git_oid_fmt(hex, oid);
-	hex[GIT_OID_HEXSZ] = 0;
+	hex[GIT_OID_SHA1_HEXSIZE] = 0;
 	check_lg2(git_object_lookup(&obj, repo, oid, GIT_OBJECT_ANY),
 			  "Unable to lookup object", hex);
 	
diff --git a/examples/general.c b/examples/general.c
index 2127ec0..9e678f8 100644
--- a/examples/general.c
+++ b/examples/general.c
@@ -129,7 +129,7 @@ int lg2_general(git_repository *repo, int argc, char** argv)
  */
 static void oid_parsing(git_oid *oid)
 {
-	char out[GIT_OID_HEXSZ+1];
+	char out[GIT_OID_SHA1_HEXSIZE+1];
 	char hex[] = "4a202b346bb0fb0db7eff3cffeb3c70babbd2045";
 
 	printf("*Hex to Raw*\n");
@@ -152,7 +152,7 @@ static void oid_parsing(git_oid *oid)
 	 * char hex value.
 	 */
 	printf("\n*Raw to Hex*\n");
-	out[GIT_OID_HEXSZ] = '\0';
+	out[GIT_OID_SHA1_HEXSIZE] = '\0';
 
 	/**
 	 * If you have a oid, you can easily get the hex value of the SHA as well.
@@ -173,7 +173,7 @@ static void oid_parsing(git_oid *oid)
  */
 static void object_database(git_repository *repo, git_oid *oid)
 {
-	char oid_hex[GIT_OID_HEXSZ+1] = { 0 };
+	char oid_hex[GIT_OID_SHA1_HEXSIZE+1] = { 0 };
 	const unsigned char *data;
 	const char *str_type;
 	int error;
@@ -266,7 +266,7 @@ static void commit_writing(git_repository *repo)
 	git_tree *tree;
 	git_commit *parent;
 	git_signature *author, *committer;
-	char oid_hex[GIT_OID_HEXSZ+1] = { 0 };
+	char oid_hex[GIT_OID_SHA1_HEXSIZE+1] = { 0 };
 
 	printf("\n*Commit Writing*\n");
 
@@ -345,7 +345,7 @@ static void commit_parsing(git_repository *repo)
 	const git_signature *author, *cmtter;
 	git_commit *commit, *parent;
 	git_oid oid;
-	char oid_hex[GIT_OID_HEXSZ+1];
+	char oid_hex[GIT_OID_SHA1_HEXSIZE+1];
 	const char *message;
 	unsigned int parents, p;
 	int error;
@@ -679,7 +679,7 @@ static void reference_listing(git_repository *repo)
 
 	for (i = 0; i < ref_list.count; ++i) {
 		git_reference *ref;
-		char oid_hex[GIT_OID_HEXSZ+1] = GIT_OID_HEX_ZERO;
+		char oid_hex[GIT_OID_SHA1_HEXSIZE+1] = GIT_OID_HEX_ZERO;
 		const char *refname;
 
 		refname = ref_list.strings[i];
diff --git a/examples/log.c b/examples/log.c
index 9060f3f..4b0a95d 100644
--- a/examples/log.c
+++ b/examples/log.c
@@ -329,7 +329,7 @@ static void print_time(const git_time *intime, const char *prefix)
 /** Helper to print a commit object. */
 static void print_commit(git_commit *commit, struct log_options *opts)
 {
-	char buf[GIT_OID_HEXSZ + 1];
+	char buf[GIT_OID_SHA1_HEXSIZE + 1];
 	int i, count;
 	const git_signature *sig;
 	const char *scan, *eol;
diff --git a/examples/ls-remote.c b/examples/ls-remote.c
index 03ed887..24caae7 100644
--- a/examples/ls-remote.c
+++ b/examples/ls-remote.c
@@ -34,7 +34,7 @@ static int use_remote(git_repository *repo, char *name)
 		goto cleanup;
 
 	for (i = 0; i < refs_len; i++) {
-		char oid[GIT_OID_HEXSZ + 1] = {0};
+		char oid[GIT_OID_SHA1_HEXSIZE + 1] = {0};
 		git_oid_fmt(oid, &refs[i]->oid);
 		printf("%s\t%s\n", oid, refs[i]->name);
 	}
diff --git a/examples/rev-list.c b/examples/rev-list.c
index d10f166..0ca40a2 100644
--- a/examples/rev-list.c
+++ b/examples/rev-list.c
@@ -26,7 +26,7 @@ int lg2_rev_list(git_repository *repo, int argc, char **argv)
 	git_revwalk *walk;
 	git_oid oid;
 	git_sort_t sort;
-	char buf[GIT_OID_HEXSZ+1];
+	char buf[GIT_OID_SHA1_HEXSIZE+1];
 
 	check_lg2(revwalk_parse_options(&sort, &args), "parsing options", NULL);
 
@@ -36,7 +36,7 @@ int lg2_rev_list(git_repository *repo, int argc, char **argv)
 
 	while (!git_revwalk_next(&oid, walk)) {
 		git_oid_fmt(buf, &oid);
-		buf[GIT_OID_HEXSZ] = '\0';
+		buf[GIT_OID_SHA1_HEXSIZE] = '\0';
 		printf("%s\n", buf);
 	}
 
diff --git a/examples/rev-parse.c b/examples/rev-parse.c
index 90258c1..3f68d79 100644
--- a/examples/rev-parse.c
+++ b/examples/rev-parse.c
@@ -65,7 +65,7 @@ static void parse_opts(struct parse_state *ps, int argc, char *argv[])
 static int parse_revision(git_repository *repo, struct parse_state *ps)
 {
 	git_revspec rs;
-	char str[GIT_OID_HEXSZ + 1];
+	char str[GIT_OID_SHA1_HEXSIZE + 1];
 
 	check_lg2(git_revparse(&rs, repo, ps->spec), "Could not parse", ps->spec);
 
diff --git a/examples/show-index.c b/examples/show-index.c
index 7aaa45e..fb797e0 100644
--- a/examples/show-index.c
+++ b/examples/show-index.c
@@ -20,8 +20,8 @@ int lg2_show_index(git_repository *repo, int argc, char **argv)
 	size_t i, ecount;
 	char *dir = ".";
 	size_t dirlen;
-	char out[GIT_OID_HEXSZ+1];
-	out[GIT_OID_HEXSZ] = '\0';
+	char out[GIT_OID_SHA1_HEXSIZE+1];
+	out[GIT_OID_SHA1_HEXSIZE] = '\0';
 
 	if (argc > 2)
 		fatal("usage: showindex [<repo-dir>]", NULL);
diff --git a/fuzzers/commit_graph_fuzzer.c b/fuzzers/commit_graph_fuzzer.c
index 1c46d78..f037801 100644
--- a/fuzzers/commit_graph_fuzzer.c
+++ b/fuzzers/commit_graph_fuzzer.c
@@ -62,7 +62,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
 		memcpy(commit_graph_buf.ptr, data, size);
 		memcpy(commit_graph_buf.ptr + size, hash, GIT_HASH_SHA1_SIZE);
 
-		memcpy(oid.id, hash, GIT_OID_RAWSZ);
+		memcpy(oid.id, hash, GIT_OID_SHA1_SIZE);
 	} else {
 		git_str_attach_notowned(&commit_graph_buf, (char *)data, size);
 	}
@@ -75,7 +75,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
 		goto cleanup;
 
 	/* Search for any oid, just to exercise that codepath. */
-	if (git_commit_graph_entry_find(&e, &file, &oid, GIT_OID_HEXSZ) < 0)
+	if (git_commit_graph_entry_find(&e, &file, &oid, GIT_OID_SHA1_HEXSIZE) < 0)
 		goto cleanup;
 
 cleanup:
diff --git a/fuzzers/midx_fuzzer.c b/fuzzers/midx_fuzzer.c
index 4c3124e..8cd1102 100644
--- a/fuzzers/midx_fuzzer.c
+++ b/fuzzers/midx_fuzzer.c
@@ -61,7 +61,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
 		memcpy(midx_buf.ptr, data, size);
 		memcpy(midx_buf.ptr + size, hash, GIT_HASH_SHA1_SIZE);
 
-		memcpy(oid.id, hash, GIT_OID_RAWSZ);
+		memcpy(oid.id, hash, GIT_OID_SHA1_SIZE);
 	} else {
 		git_str_attach_notowned(&midx_buf, (char *)data, size);
 	}
@@ -70,7 +70,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
 		goto cleanup;
 
 	/* Search for any oid, just to exercise that codepath. */
-	if (git_midx_entry_find(&e, &idx, &oid, GIT_OID_HEXSZ) < 0)
+	if (git_midx_entry_find(&e, &idx, &oid, GIT_OID_SHA1_HEXSIZE) < 0)
 		goto cleanup;
 
 cleanup:
diff --git a/fuzzers/packfile_fuzzer.c b/fuzzers/packfile_fuzzer.c
index 23ecaf8..7f448f6 100644
--- a/fuzzers/packfile_fuzzer.c
+++ b/fuzzers/packfile_fuzzer.c
@@ -94,7 +94,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
 			fprintf(stderr, "Failed to compute the SHA1 hash\n");
 			abort();
 		}
-		if (git_indexer_append(indexer, &oid.id, GIT_OID_RAWSZ, &stats) < 0) {
+		if (git_indexer_append(indexer, &oid.id, GIT_OID_SHA1_SIZE, &stats) < 0) {
 			goto cleanup;
 		}
 	}
diff --git a/include/git2/diff.h b/include/git2/diff.h
index 3839f00..850d215 100644
--- a/include/git2/diff.h
+++ b/include/git2/diff.h
@@ -274,7 +274,7 @@ typedef struct {
 
 	/**
 	 * Represents the known length of the `id` field, when
-	 * converted to a hex string.  It is generally `GIT_OID_HEXSZ`, unless this
+	 * converted to a hex string.  It is generally `GIT_OID_SHA1_HEXSIZE`, unless this
 	 * delta was created from reading a patch file, in which case it may be
 	 * abbreviated to something reasonable, like 7 characters.
 	 */
diff --git a/include/git2/odb.h b/include/git2/odb.h
index 0ffe3f3..54c38a4 100644
--- a/include/git2/odb.h
+++ b/include/git2/odb.h
@@ -117,7 +117,7 @@ GIT_EXTERN(int) git_odb_read(git_odb_object **out, git_odb *db, const git_oid *i
  * This method queries all available ODB backends
  * trying to match the 'len' first hexadecimal
  * characters of the 'short_id'.
- * The remaining (GIT_OID_HEXSZ-len)*4 bits of
+ * The remaining (GIT_OID_SHA1_HEXSIZE-len)*4 bits of
  * 'short_id' must be 0s.
  * 'len' must be at least GIT_OID_MINPREFIXLEN,
  * and the prefix must be long enough to identify
@@ -218,7 +218,7 @@ typedef struct git_odb_expand_id {
  *
  * The given array will be updated in place: for each abbreviated ID that is
  * unique in the database, and of the given type (if specified),
- * the full object ID, object ID length (`GIT_OID_HEXSZ`) and type will be
+ * the full object ID, object ID length (`GIT_OID_SHA1_HEXSIZE`) and type will be
  * written back to the array. For IDs that are not found (or are ambiguous),
  * the array entry will be zeroed.
  *
diff --git a/include/git2/oid.h b/include/git2/oid.h
index 549df4e..0d0f054 100644
--- a/include/git2/oid.h
+++ b/include/git2/oid.h
@@ -20,10 +20,10 @@
 GIT_BEGIN_DECL
 
 /** Size (in bytes) of a raw/binary oid */
-#define GIT_OID_RAWSZ 20
+#define GIT_OID_SHA1_SIZE 20
 
 /** Size (in bytes) of a hex formatted oid */
-#define GIT_OID_HEXSZ (GIT_OID_RAWSZ * 2)
+#define GIT_OID_SHA1_HEXSIZE (GIT_OID_SHA1_SIZE * 2)
 
 /** Minimum length (in number of hex characters,
  * i.e. packets of 4 bits) of an oid prefix */
@@ -32,7 +32,7 @@ GIT_BEGIN_DECL
 /** Unique identity of any object (commit, tree, blob, tag). */
 typedef struct git_oid {
 	/** raw binary formatted id */
-	unsigned char id[GIT_OID_RAWSZ];
+	unsigned char id[GIT_OID_SHA1_SIZE];
 } git_oid;
 
 /**
@@ -94,7 +94,7 @@ GIT_EXTERN(int) git_oid_fmt(char *out, const git_oid *id);
  * Format a git_oid into a partial hex string.
  *
  * @param out output hex string; you say how many bytes to write.
- *		If the number of bytes is > GIT_OID_HEXSZ, extra bytes
+ *		If the number of bytes is > GIT_OID_SHA1_HEXSIZE, extra bytes
  *		will be zeroed; if not, a '\0' terminator is NOT added.
  * @param n number of characters to write into out string
  * @param id oid structure to format.
@@ -134,7 +134,7 @@ GIT_EXTERN(char *) git_oid_tostr_s(const git_oid *oid);
 /**
  * Format a git_oid into a buffer as a hex format c-string.
  *
- * If the buffer is smaller than GIT_OID_HEXSZ+1, then the resulting
+ * If the buffer is smaller than GIT_OID_SHA1_HEXSIZE+1, then the resulting
  * oid c-string will be truncated to n-1 characters (but will still be
  * NUL-byte terminated).
  *
diff --git a/include/git2/sys/odb_backend.h b/include/git2/sys/odb_backend.h
index 8598f94..c42abd3 100644
--- a/include/git2/sys/odb_backend.h
+++ b/include/git2/sys/odb_backend.h
@@ -36,7 +36,7 @@ struct git_odb_backend {
 		void **, size_t *, git_object_t *, git_odb_backend *, const git_oid *);
 
 	/* To find a unique object given a prefix of its oid.  The oid given
-	 * must be so that the remaining (GIT_OID_HEXSZ - len)*4 bits are 0s.
+	 * must be so that the remaining (GIT_OID_SHA1_HEXSIZE - len)*4 bits are 0s.
 	 */
 	int GIT_CALLBACK(read_prefix)(
 		git_oid *, void **, size_t *, git_object_t *,
diff --git a/src/libgit2/annotated_commit.c b/src/libgit2/annotated_commit.c
index e489476..7bd8b60 100644
--- a/src/libgit2/annotated_commit.c
+++ b/src/libgit2/annotated_commit.c
@@ -40,7 +40,7 @@ static int annotated_commit_init(
 		goto done;
 
 	git_oid_fmt(annotated_commit->id_str, git_commit_id(commit));
-	annotated_commit->id_str[GIT_OID_HEXSZ] = '\0';
+	annotated_commit->id_str[GIT_OID_SHA1_HEXSIZE] = '\0';
 
 	if (!description)
 		description = annotated_commit->id_str;
diff --git a/src/libgit2/annotated_commit.h b/src/libgit2/annotated_commit.h
index 444a2ed..c87eaa8 100644
--- a/src/libgit2/annotated_commit.h
+++ b/src/libgit2/annotated_commit.h
@@ -41,7 +41,7 @@ struct git_annotated_commit {
 	const char *ref_name;
 	const char *remote_url;
 
-	char id_str[GIT_OID_HEXSZ+1];
+	char id_str[GIT_OID_SHA1_HEXSIZE+1];
 };
 
 extern int git_annotated_commit_from_head(git_annotated_commit **out,
diff --git a/src/libgit2/branch.c b/src/libgit2/branch.c
index 2e29af9..4588841 100644
--- a/src/libgit2/branch.c
+++ b/src/libgit2/branch.c
@@ -123,9 +123,9 @@ int git_branch_create(
 	const git_commit *commit,
 	int force)
 {
-	char commit_id[GIT_OID_HEXSZ + 1];
+	char commit_id[GIT_OID_SHA1_HEXSIZE + 1];
 
-	git_oid_tostr(commit_id, GIT_OID_HEXSZ + 1, git_commit_id(commit));
+	git_oid_tostr(commit_id, GIT_OID_SHA1_HEXSIZE + 1, git_commit_id(commit));
 	return create_branch(ref_out, repository, branch_name, commit, commit_id, force);
 }
 
diff --git a/src/libgit2/cherrypick.c b/src/libgit2/cherrypick.c
index 9ec4962..04812b1 100644
--- a/src/libgit2/cherrypick.c
+++ b/src/libgit2/cherrypick.c
@@ -106,10 +106,10 @@ static int cherrypick_state_cleanup(git_repository *repo)
 
 static int cherrypick_seterr(git_commit *commit, const char *fmt)
 {
-	char commit_oidstr[GIT_OID_HEXSZ + 1];
+	char commit_oidstr[GIT_OID_SHA1_HEXSIZE + 1];
 
 	git_error_set(GIT_ERROR_CHERRYPICK, fmt,
-		git_oid_tostr(commit_oidstr, GIT_OID_HEXSZ + 1, git_commit_id(commit)));
+		git_oid_tostr(commit_oidstr, GIT_OID_SHA1_HEXSIZE + 1, git_commit_id(commit)));
 
 	return -1;
 }
@@ -173,7 +173,7 @@ int git_cherrypick(
 	git_cherrypick_options opts;
 	git_reference *our_ref = NULL;
 	git_commit *our_commit = NULL;
-	char commit_oidstr[GIT_OID_HEXSZ + 1];
+	char commit_oidstr[GIT_OID_SHA1_HEXSIZE + 1];
 	const char *commit_msg, *commit_summary;
 	git_str their_label = GIT_STR_INIT;
 	git_index *index = NULL;
diff --git a/src/libgit2/commit.c b/src/libgit2/commit.c
index b137463..9516e92 100644
--- a/src/libgit2/commit.c
+++ b/src/libgit2/commit.c
@@ -411,7 +411,7 @@ static int commit_parse(git_commit *commit, const char *data, size_t size, unsig
 	    if (git_oid__parse(&commit->tree_id, &buffer, buffer_end, "tree ") < 0)
 			goto bad_buffer;
 	} else {
-		size_t tree_len = strlen("tree ") + GIT_OID_HEXSZ + 1;
+		size_t tree_len = strlen("tree ") + GIT_OID_SHA1_HEXSIZE + 1;
 		if (buffer + tree_len > buffer_end)
 			goto bad_buffer;
 		buffer += tree_len;
diff --git a/src/libgit2/commit_graph.c b/src/libgit2/commit_graph.c
index 10947ac..7e98ffb 100644
--- a/src/libgit2/commit_graph.c
+++ b/src/libgit2/commit_graph.c
@@ -138,18 +138,18 @@ static int commit_graph_parse_oid_lookup(
 		struct git_commit_graph_chunk *chunk_oid_lookup)
 {
 	uint32_t i;
-	unsigned char *oid, *prev_oid, zero_oid[GIT_OID_RAWSZ] = {0};
+	unsigned char *oid, *prev_oid, zero_oid[GIT_OID_SHA1_SIZE] = {0};
 
 	if (chunk_oid_lookup->offset == 0)
 		return commit_graph_error("missing OID Lookup chunk");
 	if (chunk_oid_lookup->length == 0)
 		return commit_graph_error("empty OID Lookup chunk");
-	if (chunk_oid_lookup->length != file->num_commits * GIT_OID_RAWSZ)
+	if (chunk_oid_lookup->length != file->num_commits * GIT_OID_SHA1_SIZE)
 		return commit_graph_error("OID Lookup chunk has wrong length");
 
 	file->oid_lookup = oid = (unsigned char *)(data + chunk_oid_lookup->offset);
 	prev_oid = zero_oid;
-	for (i = 0; i < file->num_commits; ++i, oid += GIT_OID_RAWSZ) {
+	for (i = 0; i < file->num_commits; ++i, oid += GIT_OID_SHA1_SIZE) {
 		if (git_oid_raw_cmp(prev_oid, oid) >= 0)
 			return commit_graph_error("OID Lookup index is non-monotonic");
 		prev_oid = oid;
@@ -167,7 +167,7 @@ static int commit_graph_parse_commit_data(
 		return commit_graph_error("missing Commit Data chunk");
 	if (chunk_commit_data->length == 0)
 		return commit_graph_error("empty Commit Data chunk");
-	if (chunk_commit_data->length != file->num_commits * (GIT_OID_RAWSZ + 16))
+	if (chunk_commit_data->length != file->num_commits * (GIT_OID_SHA1_SIZE + 16))
 		return commit_graph_error("Commit Data chunk has wrong length");
 
 	file->commit_data = data + chunk_commit_data->offset;
@@ -210,7 +210,7 @@ int git_commit_graph_file_parse(
 
 	GIT_ASSERT_ARG(file);
 
-	if (size < sizeof(struct git_commit_graph_header) + GIT_OID_RAWSZ)
+	if (size < sizeof(struct git_commit_graph_header) + GIT_OID_SHA1_SIZE)
 		return commit_graph_error("commit-graph is too short");
 
 	hdr = ((struct git_commit_graph_header *)data);
@@ -227,7 +227,7 @@ int git_commit_graph_file_parse(
 	 * headers, and a special zero chunk.
 	 */
 	last_chunk_offset = sizeof(struct git_commit_graph_header) + (1 + hdr->chunks) * 12;
-	trailer_offset = size - GIT_OID_RAWSZ;
+	trailer_offset = size - GIT_OID_SHA1_SIZE;
 	checksum_size = GIT_HASH_SHA1_SIZE;
 
 	if (trailer_offset < last_chunk_offset)
@@ -436,15 +436,15 @@ static int git_commit_graph_entry_get_byindex(
 		return GIT_ENOTFOUND;
 	}
 
-	commit_data = file->commit_data + pos * (GIT_OID_RAWSZ + 4 * sizeof(uint32_t));
+	commit_data = file->commit_data + pos * (GIT_OID_SHA1_SIZE + 4 * sizeof(uint32_t));
 	git_oid_fromraw(&e->tree_oid, commit_data);
-	e->parent_indices[0] = ntohl(*((uint32_t *)(commit_data + GIT_OID_RAWSZ)));
+	e->parent_indices[0] = ntohl(*((uint32_t *)(commit_data + GIT_OID_SHA1_SIZE)));
 	e->parent_indices[1] = ntohl(
-			*((uint32_t *)(commit_data + GIT_OID_RAWSZ + sizeof(uint32_t))));
+			*((uint32_t *)(commit_data + GIT_OID_SHA1_SIZE + sizeof(uint32_t))));
 	e->parent_count = (e->parent_indices[0] != GIT_COMMIT_GRAPH_MISSING_PARENT)
 			+ (e->parent_indices[1] != GIT_COMMIT_GRAPH_MISSING_PARENT);
-	e->generation = ntohl(*((uint32_t *)(commit_data + GIT_OID_RAWSZ + 2 * sizeof(uint32_t))));
-	e->commit_time = ntohl(*((uint32_t *)(commit_data + GIT_OID_RAWSZ + 3 * sizeof(uint32_t))));
+	e->generation = ntohl(*((uint32_t *)(commit_data + GIT_OID_SHA1_SIZE + 2 * sizeof(uint32_t))));
+	e->commit_time = ntohl(*((uint32_t *)(commit_data + GIT_OID_SHA1_SIZE + 3 * sizeof(uint32_t))));
 
 	e->commit_time |= (e->generation & UINT64_C(0x3)) << UINT64_C(32);
 	e->generation >>= 2u;
@@ -471,7 +471,7 @@ static int git_commit_graph_entry_get_byindex(
 		}
 	}
 
-	git_oid_fromraw(&e->sha1, &file->oid_lookup[pos * GIT_OID_RAWSZ]);
+	git_oid_fromraw(&e->sha1, &file->oid_lookup[pos * GIT_OID_SHA1_SIZE]);
 	return 0;
 }
 
@@ -524,27 +524,27 @@ int git_commit_graph_entry_find(
 	hi = ntohl(file->oid_fanout[(int)short_oid->id[0]]);
 	lo = ((short_oid->id[0] == 0x0) ? 0 : ntohl(file->oid_fanout[(int)short_oid->id[0] - 1]));
 
-	pos = git_pack__lookup_sha1(file->oid_lookup, GIT_OID_RAWSZ, lo, hi, short_oid->id);
+	pos = git_pack__lookup_sha1(file->oid_lookup, GIT_OID_SHA1_SIZE, lo, hi, short_oid->id);
 
 	if (pos >= 0) {
 		/* An object matching exactly the oid was found */
 		found = 1;
-		current = file->oid_lookup + (pos * GIT_OID_RAWSZ);
+		current = file->oid_lookup + (pos * GIT_OID_SHA1_SIZE);
 	} else {
 		/* No object was found */
 		/* pos refers to the object with the "closest" oid to short_oid */
 		pos = -1 - pos;
 		if (pos < (int)file->num_commits) {
-			current = file->oid_lookup + (pos * GIT_OID_RAWSZ);
+			current = file->oid_lookup + (pos * GIT_OID_SHA1_SIZE);
 
 			if (!git_oid_raw_ncmp(short_oid->id, current, len))
 				found = 1;
 		}
 	}
 
-	if (found && len != GIT_OID_HEXSZ && pos + 1 < (int)file->num_commits) {
+	if (found && len != GIT_OID_SHA1_HEXSIZE && pos + 1 < (int)file->num_commits) {
 		/* Check for ambiguousity */
-		const unsigned char *next = current + GIT_OID_RAWSZ;
+		const unsigned char *next = current + GIT_OID_SHA1_SIZE;
 
 		if (!git_oid_raw_ncmp(short_oid->id, next, len))
 			found = 2;
@@ -1020,7 +1020,7 @@ static int commit_graph_write(
 	git_vector_foreach (&w->commits, i, packed_commit) {
 		error = git_str_put(&oid_lookup,
 			(const char *)&packed_commit->sha1.id,
-			GIT_OID_RAWSZ);
+			GIT_OID_SHA1_SIZE);
 
 		if (error < 0)
 			goto cleanup;
@@ -1037,7 +1037,7 @@ static int commit_graph_write(
 
 		error = git_str_put(&commit_data,
 			(const char *)&packed_commit->tree_oid.id,
-			GIT_OID_RAWSZ);
+			GIT_OID_SHA1_SIZE);
 
 		if (error < 0)
 			goto cleanup;
diff --git a/src/libgit2/commit_list.c b/src/libgit2/commit_list.c
index 4585508..511d729 100644
--- a/src/libgit2/commit_list.c
+++ b/src/libgit2/commit_list.c
@@ -172,7 +172,7 @@ int git_commit_list_parse(git_revwalk *walk, git_commit_list_node *commit)
 	if (cgraph_file) {
 		git_commit_graph_entry e;
 
-		error = git_commit_graph_entry_find(&e, cgraph_file, &commit->oid, GIT_OID_RAWSZ);
+		error = git_commit_graph_entry_find(&e, cgraph_file, &commit->oid, GIT_OID_SHA1_SIZE);
 		if (error == 0 && git__is_uint16(e.parent_count)) {
 			size_t i;
 			commit->generation = (uint32_t)e.generation;
diff --git a/src/libgit2/describe.c b/src/libgit2/describe.c
index 1033eac..20a171a 100644
--- a/src/libgit2/describe.c
+++ b/src/libgit2/describe.c
@@ -368,7 +368,7 @@ static int find_unique_abbrev_size(
 	if ((error = git_repository_odb__weakptr(&odb, repo)) < 0)
 		return error;
 
-	while (size < GIT_OID_HEXSZ) {
+	while (size < GIT_OID_SHA1_HEXSIZE) {
 		if ((error = git_odb_exists_prefix(&dummy, odb, oid_in, size)) == 0) {
 			*out = (int) size;
 			return 0;
@@ -383,7 +383,7 @@ static int find_unique_abbrev_size(
 	}
 
 	/* If we didn't find any shorter prefix, we have to do the whole thing */
-	*out = GIT_OID_HEXSZ;
+	*out = GIT_OID_SHA1_HEXSIZE;
 
 	return 0;
 }
@@ -397,7 +397,7 @@ static int show_suffix(
 {
 	int error, size = 0;
 
-	char hex_oid[GIT_OID_HEXSZ];
+	char hex_oid[GIT_OID_SHA1_HEXSIZE];
 
 	if ((error = find_unique_abbrev_size(&size, repo, id, abbrev_size)) < 0)
 		return error;
@@ -414,7 +414,7 @@ static int show_suffix(
 #define MAX_CANDIDATES_TAGS FLAG_BITS - 1
 
 static int describe_not_found(const git_oid *oid, const char *message_format) {
-	char oid_str[GIT_OID_HEXSZ + 1];
+	char oid_str[GIT_OID_SHA1_HEXSIZE + 1];
 	git_oid_tostr(oid_str, sizeof(oid_str), oid);
 
 	git_error_set(GIT_ERROR_DESCRIBE, message_format, oid_str);
@@ -525,7 +525,7 @@ static int describe(
 		if (annotated_cnt && (git_pqueue_size(&list) == 0)) {
 			/*
 			if (debug) {
-				char oid_str[GIT_OID_HEXSZ + 1];
+				char oid_str[GIT_OID_SHA1_HEXSIZE + 1];
 				git_oid_tostr(oid_str, sizeof(oid_str), &c->oid);
 
 				fprintf(stderr, "finished search at %s\n", oid_str);
@@ -592,7 +592,7 @@ static int describe(
 			"head", "lightweight", "annotated",
 		};
 
-		char oid_str[GIT_OID_HEXSZ + 1];
+		char oid_str[GIT_OID_SHA1_HEXSIZE + 1];
 
 		if (debug) {
 			for (cur_match = 0; cur_match < match_cnt; cur_match++) {
@@ -816,7 +816,7 @@ static int git_describe__format(
 
 	/* If we didn't find *any* tags, we fall back to the commit's id */
 	if (result->fallback_to_id) {
-		char hex_oid[GIT_OID_HEXSZ + 1] = {0};
+		char hex_oid[GIT_OID_SHA1_HEXSIZE + 1] = {0};
 		int size = 0;
 
 		if ((error = find_unique_abbrev_size(
diff --git a/src/libgit2/diff.c b/src/libgit2/diff.c
index 9840d60..f593f73 100644
--- a/src/libgit2/diff.c
+++ b/src/libgit2/diff.c
@@ -290,7 +290,7 @@ static int flush_hunk(git_oid *result, git_hash_ctx *ctx)
 	    (error = git_hash_init(ctx)) < 0)
 		return error;
 
-	for (i = 0; i < GIT_OID_RAWSZ; i++) {
+	for (i = 0; i < GIT_OID_SHA1_SIZE; i++) {
 		carry += result->id[i] + hash.id[i];
 		result->id[i] = (unsigned char)carry;
 		carry >>= 8;
diff --git a/src/libgit2/diff_file.c b/src/libgit2/diff_file.c
index c7e9fbe..8006b31 100644
--- a/src/libgit2/diff_file.c
+++ b/src/libgit2/diff_file.c
@@ -153,7 +153,7 @@ int git_diff_file_content__init_from_src(
 			git_blob_dup((git_blob **)&fc->blob, (git_blob *) src->blob);
 			fc->file->size = git_blob_rawsize(src->blob);
 			git_oid_cpy(&fc->file->id, git_blob_id(src->blob));
-			fc->file->id_abbrev = GIT_OID_HEXSZ;
+			fc->file->id_abbrev = GIT_OID_SHA1_HEXSIZE;
 
 			fc->map.len  = (size_t)fc->file->size;
 			fc->map.data = (char *)git_blob_rawcontent(src->blob);
@@ -164,7 +164,7 @@ int git_diff_file_content__init_from_src(
 			if ((error = git_odb_hash(&fc->file->id, src->buf, src->buflen, GIT_OBJECT_BLOB)) < 0)
 				return error;
 			fc->file->size = src->buflen;
-			fc->file->id_abbrev = GIT_OID_HEXSZ;
+			fc->file->id_abbrev = GIT_OID_SHA1_HEXSIZE;
 
 			fc->map.len  = src->buflen;
 			fc->map.data = (char *)src->buf;
@@ -177,7 +177,7 @@ int git_diff_file_content__init_from_src(
 static int diff_file_content_commit_to_str(
 	git_diff_file_content *fc, bool check_status)
 {
-	char oid[GIT_OID_HEXSZ+1];
+	char oid[GIT_OID_SHA1_HEXSIZE+1];
 	git_str content = GIT_STR_INIT;
 	const char *status = "";
 
diff --git a/src/libgit2/diff_generate.c b/src/libgit2/diff_generate.c
index cfaefba..16efbc7 100644
--- a/src/libgit2/diff_generate.c
+++ b/src/libgit2/diff_generate.c
@@ -188,13 +188,13 @@ static int diff_delta__from_one(
 		delta->old_file.size = entry->file_size;
 		delta->old_file.flags |= GIT_DIFF_FLAG_EXISTS;
 		git_oid_cpy(&delta->old_file.id, &entry->id);
-		delta->old_file.id_abbrev = GIT_OID_HEXSZ;
+		delta->old_file.id_abbrev = GIT_OID_SHA1_HEXSIZE;
 	} else /* ADDED, IGNORED, UNTRACKED */ {
 		delta->new_file.mode = entry->mode;
 		delta->new_file.size = entry->file_size;
 		delta->new_file.flags |= GIT_DIFF_FLAG_EXISTS;
 		git_oid_cpy(&delta->new_file.id, &entry->id);
-		delta->new_file.id_abbrev = GIT_OID_HEXSZ;
+		delta->new_file.id_abbrev = GIT_OID_SHA1_HEXSIZE;
 	}
 
 	delta->old_file.flags |= GIT_DIFF_FLAG_VALID_ID;
@@ -249,14 +249,14 @@ static int diff_delta__from_two(
 		delta->old_file.size = old_entry->file_size;
 		delta->old_file.mode = old_mode;
 		git_oid_cpy(&delta->old_file.id, old_id);
-		delta->old_file.id_abbrev = GIT_OID_HEXSZ;
+		delta->old_file.id_abbrev = GIT_OID_SHA1_HEXSIZE;
 		delta->old_file.flags |= GIT_DIFF_FLAG_VALID_ID |
 			GIT_DIFF_FLAG_EXISTS;
 	}
 
 	if (!git_index_entry_is_conflict(new_entry)) {
 		git_oid_cpy(&delta->new_file.id, new_id);
-		delta->new_file.id_abbrev = GIT_OID_HEXSZ;
+		delta->new_file.id_abbrev = GIT_OID_SHA1_HEXSIZE;
 		delta->new_file.size = new_entry->file_size;
 		delta->new_file.mode = new_mode;
 		delta->old_file.flags |= GIT_DIFF_FLAG_EXISTS;
@@ -1695,11 +1695,11 @@ int git_diff__commit(
 	*out = NULL;
 
 	if ((parents = git_commit_parentcount(commit)) > 1) {
-		char commit_oidstr[GIT_OID_HEXSZ + 1];
+		char commit_oidstr[GIT_OID_SHA1_HEXSIZE + 1];
 
 		error = -1;
 		git_error_set(GIT_ERROR_INVALID, "commit %s is a merge commit",
-			git_oid_tostr(commit_oidstr, GIT_OID_HEXSZ + 1, git_commit_id(commit)));
+			git_oid_tostr(commit_oidstr, GIT_OID_SHA1_HEXSIZE + 1, git_commit_id(commit)));
 		goto on_error;
 	}
 
diff --git a/src/libgit2/diff_print.c b/src/libgit2/diff_print.c
index 6c5a2cd..3077e11 100644
--- a/src/libgit2/diff_print.c
+++ b/src/libgit2/diff_print.c
@@ -53,8 +53,8 @@ static int diff_print_info_init__common(
 			return -1;
 	}
 
-	if (pi->id_strlen > GIT_OID_HEXSZ)
-		pi->id_strlen = GIT_OID_HEXSZ;
+	if (pi->id_strlen > GIT_OID_SHA1_HEXSIZE)
+		pi->id_strlen = GIT_OID_SHA1_HEXSIZE;
 
 	memset(&pi->line, 0, sizeof(pi->line));
 	pi->line.old_lineno = -1;
@@ -212,7 +212,7 @@ static int diff_print_one_raw(
 	git_str *out = pi->buf;
 	int id_abbrev;
 	char code = git_diff_status_char(delta->status);
-	char start_oid[GIT_OID_HEXSZ+1], end_oid[GIT_OID_HEXSZ+1];
+	char start_oid[GIT_OID_SHA1_HEXSIZE+1], end_oid[GIT_OID_SHA1_HEXSIZE+1];
 
 	GIT_UNUSED(progress);
 
@@ -235,7 +235,7 @@ static int diff_print_one_raw(
 	git_oid_tostr(end_oid, pi->id_strlen + 1, &delta->new_file.id);
 
 	git_str_printf(
-		out, (pi->id_strlen <= GIT_OID_HEXSZ) ?
+		out, (pi->id_strlen <= GIT_OID_SHA1_HEXSIZE) ?
 			":%06o %06o %s... %s... %c" : ":%06o %06o %s %s %c",
 		delta->old_file.mode, delta->new_file.mode, start_oid, end_oid, code);
 
@@ -273,7 +273,7 @@ static int diff_print_oid_range(
 	git_str *out, const git_diff_delta *delta, int id_strlen,
 	bool print_index)
 {
-	char start_oid[GIT_OID_HEXSZ+1], end_oid[GIT_OID_HEXSZ+1];
+	char start_oid[GIT_OID_SHA1_HEXSIZE+1], end_oid[GIT_OID_SHA1_HEXSIZE+1];
 
 	if (delta->old_file.mode &&
 			id_strlen > delta->old_file.id_abbrev) {
diff --git a/src/libgit2/email.c b/src/libgit2/email.c
index e19a292..0a75021 100644
--- a/src/libgit2/email.c
+++ b/src/libgit2/email.c
@@ -130,11 +130,11 @@ static int append_header(
 	const git_signature *author,
 	git_email_create_options *opts)
 {
-	char id[GIT_OID_HEXSZ];
+	char id[GIT_OID_SHA1_HEXSIZE];
 	int error;
 
 	if ((error = git_oid_fmt(id, commit_id)) < 0 ||
-	    (error = git_str_printf(out, "From %.*s %s\n", GIT_OID_HEXSZ, id, EMAIL_TIMESTAMP)) < 0 ||
+	    (error = git_str_printf(out, "From %.*s %s\n", GIT_OID_SHA1_HEXSIZE, id, EMAIL_TIMESTAMP)) < 0 ||
 	    (error = git_str_printf(out, "From: %s <%s>\n", author->name, author->email)) < 0 ||
 	    (error = append_date(out, &author->when)) < 0 ||
 	    (error = append_subject(out, patch_idx, patch_count, summary, opts)) < 0)
diff --git a/src/libgit2/fetchhead.c b/src/libgit2/fetchhead.c
index 6511124..146d891 100644
--- a/src/libgit2/fetchhead.c
+++ b/src/libgit2/fetchhead.c
@@ -105,7 +105,7 @@ static int fetchhead_ref_write(
 	git_filebuf *file,
 	git_fetchhead_ref *fetchhead_ref)
 {
-	char oid[GIT_OID_HEXSZ + 1];
+	char oid[GIT_OID_SHA1_HEXSIZE + 1];
 	const char *type, *name;
 	int head = 0;
 
@@ -113,7 +113,7 @@ static int fetchhead_ref_write(
 	GIT_ASSERT_ARG(fetchhead_ref);
 
 	git_oid_fmt(oid, &fetchhead_ref->oid);
-	oid[GIT_OID_HEXSZ] = '\0';
+	oid[GIT_OID_SHA1_HEXSIZE] = '\0';
 
 	if (git__prefixcmp(fetchhead_ref->ref_name, GIT_REFS_HEADS_DIR) == 0) {
 		type = "branch ";
@@ -196,7 +196,7 @@ static int fetchhead_ref_parse(
 		*is_merge = 1;
 	}
 
-	if (strlen(oid_str) != GIT_OID_HEXSZ) {
+	if (strlen(oid_str) != GIT_OID_SHA1_HEXSIZE) {
 		git_error_set(GIT_ERROR_FETCHHEAD,
 			"invalid object ID in FETCH_HEAD line %"PRIuZ, line_num);
 		return -1;
diff --git a/src/libgit2/ident.c b/src/libgit2/ident.c
index 5309586..bf9a499 100644
--- a/src/libgit2/ident.c
+++ b/src/libgit2/ident.c
@@ -42,7 +42,7 @@ static int ident_find_id(
 static int ident_insert_id(
 	git_str *to, const git_str *from, const git_filter_source *src)
 {
-	char oid[GIT_OID_HEXSZ+1];
+	char oid[GIT_OID_SHA1_HEXSIZE+1];
 	const char *id_start, *id_end, *from_end = from->ptr + from->size;
 	size_t need_size;
 
@@ -57,7 +57,7 @@ static int ident_insert_id(
 		return GIT_PASSTHROUGH;
 
 	need_size = (size_t)(id_start - from->ptr) +
-		5 /* "$Id: " */ + GIT_OID_HEXSZ + 2 /* " $" */ +
+		5 /* "$Id: " */ + GIT_OID_SHA1_HEXSIZE + 2 /* " $" */ +
 		(size_t)(from_end - id_end);
 
 	if (git_str_grow(to, need_size) < 0)
@@ -65,7 +65,7 @@ static int ident_insert_id(
 
 	git_str_set(to, from->ptr, (size_t)(id_start - from->ptr));
 	git_str_put(to, "$Id: ", 5);
-	git_str_put(to, oid, GIT_OID_HEXSZ);
+	git_str_put(to, oid, GIT_OID_SHA1_HEXSIZE);
 	git_str_put(to, " $", 2);
 	git_str_put(to, id_end, (size_t)(from_end - id_end));
 
diff --git a/src/libgit2/index.c b/src/libgit2/index.c
index f44c507..977820a 100644
--- a/src/libgit2/index.c
+++ b/src/libgit2/index.c
@@ -74,7 +74,7 @@ struct entry_short {
 	uint32_t uid;
 	uint32_t gid;
 	uint32_t file_size;
-	unsigned char oid[GIT_OID_RAWSZ];
+	unsigned char oid[GIT_OID_SHA1_SIZE];
 	uint16_t flags;
 	char path[1]; /* arbitrary length */
 };
@@ -88,7 +88,7 @@ struct entry_long {
 	uint32_t uid;
 	uint32_t gid;
 	uint32_t file_size;
-	unsigned char oid[GIT_OID_RAWSZ];
+	unsigned char oid[GIT_OID_SHA1_SIZE];
 	uint16_t flags;
 	uint16_t flags_extended;
 	char path[1]; /* arbitrary length */
@@ -2968,7 +2968,7 @@ static int create_reuc_extension_data(git_str *reuc_buf, git_index_reuc_entry *r
 	}
 
 	for (i = 0; i < 3; i++) {
-		if (reuc->mode[i] && (error = git_str_put(reuc_buf, (char *)&reuc->oid[i].id, GIT_OID_RAWSZ)) < 0)
+		if (reuc->mode[i] && (error = git_str_put(reuc_buf, (char *)&reuc->oid[i].id, GIT_OID_SHA1_SIZE)) < 0)
 			return error;
 	}
 
diff --git a/src/libgit2/indexer.c b/src/libgit2/indexer.c
index afb9ce8..f3d701f 100644
--- a/src/libgit2/indexer.c
+++ b/src/libgit2/indexer.c
@@ -68,7 +68,7 @@ struct git_indexer {
 	git_odb *odb;
 
 	/* Fields for calculating the packfile trailer (hash of everything before it) */
-	char inbuf[GIT_OID_RAWSZ];
+	char inbuf[GIT_OID_SHA1_SIZE];
 	size_t inbuf_len;
 	git_hash_ctx trailer;
 };
@@ -272,7 +272,7 @@ static int advance_delta_offset(git_indexer *idx, git_object_t type)
 	GIT_ASSERT_ARG(type == GIT_OBJECT_REF_DELTA || type == GIT_OBJECT_OFS_DELTA);
 
 	if (type == GIT_OBJECT_REF_DELTA) {
-		idx->off += GIT_OID_RAWSZ;
+		idx->off += GIT_OID_SHA1_SIZE;
 	} else {
 		off64_t base_off;
 		int error = get_delta_base(&base_off, idx->pack, &w, &idx->off, type, idx->entry_start);
@@ -587,25 +587,25 @@ static void hash_partially(git_indexer *idx, const uint8_t *data, size_t size)
 		return;
 
 	/* Easy case, dump the buffer and the data minus the last 20 bytes */
-	if (size >= GIT_OID_RAWSZ) {
+	if (size >= GIT_OID_SHA1_SIZE) {
 		git_hash_update(&idx->trailer, idx->inbuf, idx->inbuf_len);
-		git_hash_update(&idx->trailer, data, size - GIT_OID_RAWSZ);
+		git_hash_update(&idx->trailer, data, size - GIT_OID_SHA1_SIZE);
 
-		data += size - GIT_OID_RAWSZ;
-		memcpy(idx->inbuf, data, GIT_OID_RAWSZ);
-		idx->inbuf_len = GIT_OID_RAWSZ;
+		data += size - GIT_OID_SHA1_SIZE;
+		memcpy(idx->inbuf, data, GIT_OID_SHA1_SIZE);
+		idx->inbuf_len = GIT_OID_SHA1_SIZE;
 		return;
 	}
 
 	/* We can just append */
-	if (idx->inbuf_len + size <= GIT_OID_RAWSZ) {
+	if (idx->inbuf_len + size <= GIT_OID_SHA1_SIZE) {
 		memcpy(idx->inbuf + idx->inbuf_len, data, size);
 		idx->inbuf_len += size;
 		return;
 	}
 
 	/* We need to partially drain the buffer and then append */
-	to_keep   = GIT_OID_RAWSZ - size;
+	to_keep   = GIT_OID_SHA1_SIZE - size;
 	to_expell = idx->inbuf_len - to_keep;
 
 	git_hash_update(&idx->trailer, idx->inbuf, to_expell);
@@ -900,7 +900,7 @@ static int index_path(git_str *path, git_indexer *idx, const char *suffix)
 		slash--;
 
 	if (git_str_grow(path, slash + 1 + strlen(prefix) +
-					 GIT_OID_HEXSZ + strlen(suffix) + 1) < 0)
+					 GIT_OID_SHA1_HEXSIZE + strlen(suffix) + 1) < 0)
 		return -1;
 
 	git_str_truncate(path, slash);
@@ -917,7 +917,7 @@ static int index_path(git_str *path, git_indexer *idx, const char *suffix)
  */
 static int seek_back_trailer(git_indexer *idx)
 {
-	idx->pack->mwf.size -= GIT_OID_RAWSZ;
+	idx->pack->mwf.size -= GIT_OID_SHA1_SIZE;
 	return git_mwindow_free_all(&idx->pack->mwf);
 }
 
@@ -977,7 +977,7 @@ static int inject_object(git_indexer *idx, git_oid *id)
 	if ((error = append_to_pack(idx, empty_checksum, checksum_size)) < 0)
 		goto cleanup;
 
-	idx->pack->mwf.size += GIT_OID_RAWSZ;
+	idx->pack->mwf.size += GIT_OID_SHA1_SIZE;
 
 	pentry = git__calloc(1, sizeof(struct git_pack_entry));
 	GIT_ERROR_CHECK_ALLOC(pentry);
@@ -1040,7 +1040,7 @@ static int fix_thin_pack(git_indexer *idx, git_indexer_progress *stats)
 	}
 
 	/* curpos now points to the base information, which is an OID */
-	base_info = git_mwindow_open(&idx->pack->mwf, &w, curpos, GIT_OID_RAWSZ, &left);
+	base_info = git_mwindow_open(&idx->pack->mwf, &w, curpos, GIT_OID_SHA1_SIZE, &left);
 	if (base_info == NULL) {
 		git_error_set(GIT_ERROR_INDEXER, "failed to map delta information");
 		return -1;
@@ -1269,7 +1269,7 @@ int git_indexer_commit(git_indexer *idx, git_indexer_progress *stats)
 
 	/* Write out the object names (SHA-1 hashes) */
 	git_vector_foreach(&idx->objects, i, entry) {
-		git_filebuf_write(&index_file, &entry->oid.id, GIT_OID_RAWSZ);
+		git_filebuf_write(&index_file, &entry->oid.id, GIT_OID_SHA1_SIZE);
 	}
 
 	/* Write out the CRC32 values */
diff --git a/src/libgit2/iterator.c b/src/libgit2/iterator.c
index bc6f766..6b127af 100644
--- a/src/libgit2/iterator.c
+++ b/src/libgit2/iterator.c
@@ -1271,7 +1271,7 @@ static int filesystem_iterator_entry_hash(
 	int error;
 
 	if (S_ISDIR(entry->st.st_mode)) {
-		memset(&entry->id, 0, GIT_OID_RAWSZ);
+		memset(&entry->id, 0, GIT_OID_SHA1_SIZE);
 		return 0;
 	}
 
diff --git a/src/libgit2/merge.c b/src/libgit2/merge.c
index 641b326..01f60ab 100644
--- a/src/libgit2/merge.c
+++ b/src/libgit2/merge.c
@@ -611,7 +611,7 @@ int git_repository_mergehead_foreach(
 	buffer = merge_head_file.ptr;
 
 	while ((line = git__strsep(&buffer, "\n")) != NULL) {
-		if (strlen(line) != GIT_OID_HEXSZ) {
+		if (strlen(line) != GIT_OID_SHA1_HEXSIZE) {
 			git_error_set(GIT_ERROR_INVALID, "unable to parse OID - invalid length");
 			error = -1;
 			goto cleanup;
diff --git a/src/libgit2/midx.c b/src/libgit2/midx.c
index 67eab9a..86803fa 100644
--- a/src/libgit2/midx.c
+++ b/src/libgit2/midx.c
@@ -115,18 +115,18 @@ static int midx_parse_oid_lookup(
 		struct git_midx_chunk *chunk_oid_lookup)
 {
 	uint32_t i;
-	unsigned char *oid, *prev_oid, zero_oid[GIT_OID_RAWSZ] = {0};
+	unsigned char *oid, *prev_oid, zero_oid[GIT_OID_SHA1_SIZE] = {0};
 
 	if (chunk_oid_lookup->offset == 0)
 		return midx_error("missing OID Lookup chunk");
 	if (chunk_oid_lookup->length == 0)
 		return midx_error("empty OID Lookup chunk");
-	if (chunk_oid_lookup->length != idx->num_objects * GIT_OID_RAWSZ)
+	if (chunk_oid_lookup->length != idx->num_objects * GIT_OID_SHA1_SIZE)
 		return midx_error("OID Lookup chunk has wrong length");
 
 	idx->oid_lookup = oid = (unsigned char *)(data + chunk_oid_lookup->offset);
 	prev_oid = zero_oid;
-	for (i = 0; i < idx->num_objects; ++i, oid += GIT_OID_RAWSZ) {
+	for (i = 0; i < idx->num_objects; ++i, oid += GIT_OID_SHA1_SIZE) {
 		if (git_oid_raw_cmp(prev_oid, oid) >= 0)
 			return midx_error("OID Lookup index is non-monotonic");
 		prev_oid = oid;
@@ -188,7 +188,7 @@ int git_midx_parse(
 
 	GIT_ASSERT_ARG(idx);
 
-	if (size < sizeof(struct git_midx_header) + GIT_OID_RAWSZ)
+	if (size < sizeof(struct git_midx_header) + GIT_OID_SHA1_SIZE)
 		return midx_error("multi-pack index is too short");
 
 	hdr = ((struct git_midx_header *)data);
@@ -365,7 +365,7 @@ bool git_midx_needs_refresh(
 	}
 
 	checksum_size = GIT_HASH_SHA1_SIZE;
-	bytes_read = p_pread(fd, checksum, checksum_size, st.st_size - GIT_OID_RAWSZ);
+	bytes_read = p_pread(fd, checksum, checksum_size, st.st_size - GIT_OID_SHA1_SIZE);
 	p_close(fd);
 
 	if (bytes_read != (ssize_t)checksum_size)
@@ -392,27 +392,27 @@ int git_midx_entry_find(
 	hi = ntohl(idx->oid_fanout[(int)short_oid->id[0]]);
 	lo = ((short_oid->id[0] == 0x0) ? 0 : ntohl(idx->oid_fanout[(int)short_oid->id[0] - 1]));
 
-	pos = git_pack__lookup_sha1(idx->oid_lookup, GIT_OID_RAWSZ, lo, hi, short_oid->id);
+	pos = git_pack__lookup_sha1(idx->oid_lookup, GIT_OID_SHA1_SIZE, lo, hi, short_oid->id);
 
 	if (pos >= 0) {
 		/* An object matching exactly the oid was found */
 		found = 1;
-		current = idx->oid_lookup + (pos * GIT_OID_RAWSZ);
+		current = idx->oid_lookup + (pos * GIT_OID_SHA1_SIZE);
 	} else {
 		/* No object was found */
 		/* pos refers to the object with the "closest" oid to short_oid */
 		pos = -1 - pos;
 		if (pos < (int)idx->num_objects) {
-			current = idx->oid_lookup + (pos * GIT_OID_RAWSZ);
+			current = idx->oid_lookup + (pos * GIT_OID_SHA1_SIZE);
 
 			if (!git_oid_raw_ncmp(short_oid->id, current, len))
 				found = 1;
 		}
 	}
 
-	if (found && len != GIT_OID_HEXSZ && pos + 1 < (int)idx->num_objects) {
+	if (found && len != GIT_OID_SHA1_HEXSIZE && pos + 1 < (int)idx->num_objects) {
 		/* Check for ambiguousity */
-		const unsigned char *next = current + GIT_OID_RAWSZ;
+		const unsigned char *next = current + GIT_OID_SHA1_SIZE;
 
 		if (!git_oid_raw_ncmp(short_oid->id, next, len))
 			found = 2;
@@ -459,7 +459,7 @@ int git_midx_foreach_entry(
 	GIT_ASSERT_ARG(idx);
 
 	for (i = 0; i < idx->num_objects; ++i) {
-		if ((error = git_oid_fromraw(&oid, &idx->oid_lookup[i * GIT_OID_RAWSZ])) < 0)
+		if ((error = git_oid_fromraw(&oid, &idx->oid_lookup[i * GIT_OID_SHA1_SIZE])) < 0)
 			return error;
 
 		if ((error = cb(&oid, data)) != 0)
@@ -748,7 +748,7 @@ static int midx_write(
 
 	/* Fill the OID Lookup table. */
 	git_vector_foreach (&object_entries, i, entry) {
-		error = git_str_put(&oid_lookup, (char *)&entry->sha1.id, GIT_OID_RAWSZ);
+		error = git_str_put(&oid_lookup, (char *)&entry->sha1.id, GIT_OID_SHA1_SIZE);
 		if (error < 0)
 			goto cleanup;
 	}
diff --git a/src/libgit2/notes.c b/src/libgit2/notes.c
index d1a2b0f..a154d96 100644
--- a/src/libgit2/notes.c
+++ b/src/libgit2/notes.c
@@ -460,7 +460,7 @@ int git_note_commit_read(
 {
 	int error;
 	git_tree *tree = NULL;
-	char target[GIT_OID_HEXSZ + 1];
+	char target[GIT_OID_SHA1_HEXSIZE + 1];
 
 	git_oid_tostr(target, sizeof(target), oid);
 
@@ -507,7 +507,7 @@ int git_note_commit_create(
 {
 	int error;
 	git_tree *tree = NULL;
-	char target[GIT_OID_HEXSZ + 1];
+	char target[GIT_OID_SHA1_HEXSIZE + 1];
 
 	git_oid_tostr(target, sizeof(target), oid);
 
@@ -578,7 +578,7 @@ int git_note_commit_remove(
 {
 	int error;
 	git_tree *tree = NULL;
-	char target[GIT_OID_HEXSZ + 1];
+	char target[GIT_OID_SHA1_HEXSIZE + 1];
 
 	git_oid_tostr(target, sizeof(target), oid);
 
@@ -698,7 +698,7 @@ static int process_entry_path(
 	buf.ptr[j] = '\0';
 	buf.size = j;
 
-	if (j != GIT_OID_HEXSZ) {
+	if (j != GIT_OID_SHA1_HEXSIZE) {
 		/* This is not a note entry */
 		goto cleanup;
 	}
diff --git a/src/libgit2/object.c b/src/libgit2/object.c
index b828f88..c280939 100644
--- a/src/libgit2/object.c
+++ b/src/libgit2/object.c
@@ -193,10 +193,10 @@ int git_object_lookup_prefix(
 	if (error < 0)
 		return error;
 
-	if (len > GIT_OID_HEXSZ)
-		len = GIT_OID_HEXSZ;
+	if (len > GIT_OID_SHA1_HEXSIZE)
+		len = GIT_OID_SHA1_HEXSIZE;
 
-	if (len == GIT_OID_HEXSZ) {
+	if (len == GIT_OID_SHA1_HEXSIZE) {
 		git_cached_obj *cached = NULL;
 
 		/* We want to match the full id : we can first look up in the cache,
@@ -234,7 +234,7 @@ int git_object_lookup_prefix(
 
 		git_oid__cpy_prefix(&short_oid, id, len);
 
-		/* If len < GIT_OID_HEXSZ (a strict short oid was given), we have
+		/* If len < GIT_OID_SHA1_HEXSIZE (a strict short oid was given), we have
 		 * 2 options :
 		 * - We always search in the cache first. If we find that short oid is
 		 *	ambiguous, we can stop. But in all the other cases, we must then
@@ -259,7 +259,7 @@ int git_object_lookup_prefix(
 }
 
 int git_object_lookup(git_object **object_out, git_repository *repo, const git_oid *id, git_object_t type) {
-	return git_object_lookup_prefix(object_out, repo, id, GIT_OID_HEXSZ, type);
+	return git_object_lookup_prefix(object_out, repo, id, GIT_OID_SHA1_HEXSIZE, type);
 }
 
 void git_object_free(git_object *object)
@@ -358,12 +358,12 @@ static int dereference_object(git_object **dereferenced, git_object *obj)
 static int peel_error(int error, const git_oid *oid, git_object_t type)
 {
 	const char *type_name;
-	char hex_oid[GIT_OID_HEXSZ + 1];
+	char hex_oid[GIT_OID_SHA1_HEXSIZE + 1];
 
 	type_name = git_object_type2string(type);
 
 	git_oid_fmt(hex_oid, oid);
-	hex_oid[GIT_OID_HEXSZ] = '\0';
+	hex_oid[GIT_OID_SHA1_HEXSIZE] = '\0';
 
 	git_error_set(GIT_ERROR_OBJECT, "the git_object of id '%s' can not be "
 		"successfully peeled into a %s (git_object_t=%i).", hex_oid, type_name, type);
@@ -516,7 +516,7 @@ static int git_object__short_id(git_str *out, const git_object *obj)
 	if ((error = git_repository_odb(&odb, repo)) < 0)
 		return error;
 
-	while (len < GIT_OID_HEXSZ) {
+	while (len < GIT_OID_SHA1_HEXSIZE) {
 		/* set up short oid */
 		memcpy(&id.id, &obj->cached.oid.id, (len + 1) / 2);
 		if (len & 1)
diff --git a/src/libgit2/odb.c b/src/libgit2/odb.c
index 7b98c72..43a64fc 100644
--- a/src/libgit2/odb.c
+++ b/src/libgit2/odb.c
@@ -973,7 +973,7 @@ int git_odb_exists_prefix(
 	if (len < GIT_OID_MINPREFIXLEN)
 		return git_odb__error_ambiguous("prefix length too short");
 
-	if (len >= GIT_OID_HEXSZ) {
+	if (len >= GIT_OID_SHA1_HEXSIZE) {
 		if (git_odb_exists(db, short_id)) {
 			if (out)
 				git_oid_cpy(out, short_id);
@@ -1015,13 +1015,13 @@ int git_odb_expand_ids(
 			query->type = GIT_OBJECT_ANY;
 
 		/* if we have a short OID, expand it first */
-		if (query->length >= GIT_OID_MINPREFIXLEN && query->length < GIT_OID_HEXSZ) {
+		if (query->length >= GIT_OID_MINPREFIXLEN && query->length < GIT_OID_SHA1_HEXSIZE) {
 			git_oid actual_id;
 
 			error = odb_exists_prefix_1(&actual_id, db, &query->id, query->length, false);
 			if (!error) {
 				git_oid_cpy(&query->id, &actual_id);
-				query->length = GIT_OID_HEXSZ;
+				query->length = GIT_OID_SHA1_HEXSIZE;
 			}
 		}
 
@@ -1029,7 +1029,7 @@ int git_odb_expand_ids(
 		 * now we ought to have a 40-char OID, either because we've expanded it
 		 * or because the user passed a full OID. Ensure its type is right.
 		 */
-		if (query->length >= GIT_OID_HEXSZ) {
+		if (query->length >= GIT_OID_SHA1_HEXSIZE) {
 			git_object_t actual_type;
 
 			error = odb_otype_fast(&actual_type, db, &query->id);
@@ -1157,7 +1157,7 @@ int git_odb__read_header_or_object(
 		error = odb_read_header_1(len_p, type_p, db, id, true);
 
 	if (error == GIT_ENOTFOUND)
-		return git_odb__error_notfound("cannot read header for", id, GIT_OID_HEXSZ);
+		return git_odb__error_notfound("cannot read header for", id, GIT_OID_SHA1_HEXSIZE);
 
 	/* we found the header; return early */
 	if (!error)
@@ -1268,7 +1268,7 @@ int git_odb_read(git_odb_object **out, git_odb *db, const git_oid *id)
 		error = odb_read_1(out, db, id, true);
 
 	if (error == GIT_ENOTFOUND)
-		return git_odb__error_notfound("no match for id", id, GIT_OID_HEXSZ);
+		return git_odb__error_notfound("no match for id", id, GIT_OID_SHA1_HEXSIZE);
 
 	return error;
 }
@@ -1400,10 +1400,10 @@ int git_odb_read_prefix(
 	if (len < GIT_OID_MINPREFIXLEN)
 		return git_odb__error_ambiguous("prefix length too short");
 
-	if (len > GIT_OID_HEXSZ)
-		len = GIT_OID_HEXSZ;
+	if (len > GIT_OID_SHA1_HEXSIZE)
+		len = GIT_OID_SHA1_HEXSIZE;
 
-	if (len == GIT_OID_HEXSZ) {
+	if (len == GIT_OID_SHA1_HEXSIZE) {
 		*out = git_cache_get_raw(odb_cache(db), short_id);
 		if (*out != NULL)
 			return 0;
@@ -1786,7 +1786,7 @@ int git_odb_refresh(struct git_odb *db)
 
 int git_odb__error_mismatch(const git_oid *expected, const git_oid *actual)
 {
-	char expected_oid[GIT_OID_HEXSZ + 1], actual_oid[GIT_OID_HEXSZ + 1];
+	char expected_oid[GIT_OID_SHA1_HEXSIZE + 1], actual_oid[GIT_OID_SHA1_HEXSIZE + 1];
 
 	git_oid_tostr(expected_oid, sizeof(expected_oid), expected);
 	git_oid_tostr(actual_oid, sizeof(actual_oid), actual);
@@ -1801,7 +1801,7 @@ int git_odb__error_notfound(
 	const char *message, const git_oid *oid, size_t oid_len)
 {
 	if (oid != NULL) {
-		char oid_str[GIT_OID_HEXSZ + 1];
+		char oid_str[GIT_OID_SHA1_HEXSIZE + 1];
 		git_oid_tostr(oid_str, oid_len+1, oid);
 		git_error_set(GIT_ERROR_ODB, "object not found - %s (%.*s)",
 			message, (int) oid_len, oid_str);
diff --git a/src/libgit2/odb_loose.c b/src/libgit2/odb_loose.c
index 463e24f..4700f97 100644
--- a/src/libgit2/odb_loose.c
+++ b/src/libgit2/odb_loose.c
@@ -60,11 +60,11 @@ typedef struct loose_backend {
  */
 typedef struct {
 	size_t dir_len;
-	unsigned char short_oid[GIT_OID_HEXSZ]; /* hex formatted oid to match */
+	unsigned char short_oid[GIT_OID_SHA1_HEXSIZE]; /* hex formatted oid to match */
 	size_t short_oid_len;
 	int found;				/* number of matching
 						 * objects already found */
-	unsigned char res_oid[GIT_OID_HEXSZ];	/* hex formatted oid of
+	unsigned char res_oid[GIT_OID_SHA1_HEXSIZE];	/* hex formatted oid of
 						 * the object found */
 } loose_locate_object_state;
 
@@ -81,7 +81,7 @@ static int object_file_name(
 	size_t alloclen;
 
 	/* expand length for object root + 40 hex sha1 chars + 2 * '/' + '\0' */
-	GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, be->objects_dirlen, GIT_OID_HEXSZ);
+	GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, be->objects_dirlen, GIT_OID_SHA1_HEXSIZE);
 	GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, 3);
 	if (git_str_grow(name, alloclen) < 0)
 		return -1;
@@ -91,7 +91,7 @@ static int object_file_name(
 
 	/* loose object filename: aa/aaa... (41 bytes) */
 	git_oid_pathfmt(name->ptr + name->size, id);
-	name->size += GIT_OID_HEXSZ + 1;
+	name->size += GIT_OID_SHA1_HEXSIZE + 1;
 	name->ptr[name->size] = '\0';
 
 	return 0;
@@ -462,7 +462,7 @@ static int locate_object(
 static int fn_locate_object_short_oid(void *state, git_str *pathbuf) {
 	loose_locate_object_state *sstate = (loose_locate_object_state *)state;
 
-	if (git_str_len(pathbuf) - sstate->dir_len != GIT_OID_HEXSZ - 2) {
+	if (git_str_len(pathbuf) - sstate->dir_len != GIT_OID_SHA1_HEXSIZE - 2) {
 		/* Entry cannot be an object. Continue to next entry */
 		return 0;
 	}
@@ -477,7 +477,7 @@ static int fn_locate_object_short_oid(void *state, git_str *pathbuf) {
 			if (!sstate->found) {
 				sstate->res_oid[0] = sstate->short_oid[0];
 				sstate->res_oid[1] = sstate->short_oid[1];
-				memcpy(sstate->res_oid+2, pathbuf->ptr+sstate->dir_len, GIT_OID_HEXSZ-2);
+				memcpy(sstate->res_oid+2, pathbuf->ptr+sstate->dir_len, GIT_OID_SHA1_HEXSIZE-2);
 			}
 			sstate->found++;
 		}
@@ -503,7 +503,7 @@ static int locate_object_short_oid(
 	int error;
 
 	/* prealloc memory for OBJ_DIR/xx/xx..38x..xx */
-	GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, dir_len, GIT_OID_HEXSZ);
+	GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, dir_len, GIT_OID_SHA1_HEXSIZE);
 	GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 3);
 	if (git_str_grow(object_location, alloc_len) < 0)
 		return -1;
@@ -550,7 +550,7 @@ static int locate_object_short_oid(
 		return error;
 
 	/* Update the location according to the oid obtained */
-	GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, dir_len, GIT_OID_HEXSZ);
+	GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, dir_len, GIT_OID_SHA1_HEXSIZE);
 	GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 2);
 
 	git_str_truncate(object_location, dir_len);
@@ -559,7 +559,7 @@ static int locate_object_short_oid(
 
 	git_oid_pathfmt(object_location->ptr + dir_len, res_oid);
 
-	object_location->size += GIT_OID_HEXSZ + 1;
+	object_location->size += GIT_OID_SHA1_HEXSIZE + 1;
 	object_location->ptr[object_location->size] = '\0';
 
 	return 0;
@@ -595,7 +595,7 @@ static int loose_backend__read_header(size_t *len_p, git_object_t *type_p, git_o
 
 	if (locate_object(&object_path, (loose_backend *)backend, oid) < 0) {
 		error = git_odb__error_notfound("no matching loose object",
-			oid, GIT_OID_HEXSZ);
+			oid, GIT_OID_SHA1_HEXSIZE);
 	} else if ((error = read_header_loose(&raw, &object_path)) == 0) {
 		*len_p = raw.len;
 		*type_p = raw.type;
@@ -617,7 +617,7 @@ static int loose_backend__read(void **buffer_p, size_t *len_p, git_object_t *typ
 
 	if (locate_object(&object_path, (loose_backend *)backend, oid) < 0) {
 		error = git_odb__error_notfound("no matching loose object",
-			oid, GIT_OID_HEXSZ);
+			oid, GIT_OID_SHA1_HEXSIZE);
 	} else if ((error = read_loose(&raw, &object_path)) == 0) {
 		*buffer_p = raw.data;
 		*len_p = raw.len;
@@ -640,9 +640,9 @@ static int loose_backend__read_prefix(
 {
 	int error = 0;
 
-	GIT_ASSERT_ARG(len >= GIT_OID_MINPREFIXLEN && len <= GIT_OID_HEXSZ);
+	GIT_ASSERT_ARG(len >= GIT_OID_MINPREFIXLEN && len <= GIT_OID_SHA1_HEXSIZE);
 
-	if (len == GIT_OID_HEXSZ) {
+	if (len == GIT_OID_SHA1_HEXSIZE) {
 		/* We can fall back to regular read method */
 		error = loose_backend__read(buffer_p, len_p, type_p, backend, short_oid);
 		if (!error)
@@ -711,7 +711,7 @@ struct foreach_state {
 GIT_INLINE(int) filename_to_oid(git_oid *oid, const char *ptr)
 {
 	int v, i = 0;
-	if (strlen(ptr) != GIT_OID_HEXSZ+1)
+	if (strlen(ptr) != GIT_OID_SHA1_HEXSIZE+1)
 		return -1;
 
 	if (ptr[2] != '/') {
@@ -1013,7 +1013,7 @@ static int loose_backend__readstream(
 
 	if (locate_object(&object_path, backend, oid) < 0) {
 		error = git_odb__error_notfound("no matching loose object",
-			oid, GIT_OID_HEXSZ);
+			oid, GIT_OID_SHA1_HEXSIZE);
 		goto done;
 	}
 
diff --git a/src/libgit2/odb_pack.c b/src/libgit2/odb_pack.c
index 818cc61..2401e95 100644
--- a/src/libgit2/odb_pack.c
+++ b/src/libgit2/odb_pack.c
@@ -177,7 +177,7 @@ static int pack_entry_find(struct git_pack_entry *e,
  * a prefix of an identifier.
  * Sets GIT_EAMBIGUOUS if short oid is ambiguous.
  * This method assumes that len is between
- * GIT_OID_MINPREFIXLEN and GIT_OID_HEXSZ.
+ * GIT_OID_MINPREFIXLEN and GIT_OID_SHA1_HEXSIZE.
  */
 static int pack_entry_find_prefix(
 	struct git_pack_entry *e,
@@ -273,7 +273,7 @@ static int pack_entry_find(struct git_pack_entry *e, struct pack_backend *backen
 	size_t i;
 
 	if (backend->midx &&
-		git_midx_entry_find(&midx_entry, backend->midx, oid, GIT_OID_HEXSZ) == 0 &&
+		git_midx_entry_find(&midx_entry, backend->midx, oid, GIT_OID_SHA1_HEXSIZE) == 0 &&
 		midx_entry.pack_index < git_vector_length(&backend->midx_packs)) {
 		e->offset = midx_entry.offset;
 		git_oid_cpy(&e->sha1, &midx_entry.sha1);
@@ -282,21 +282,21 @@ static int pack_entry_find(struct git_pack_entry *e, struct pack_backend *backen
 	}
 
 	if (last_found &&
-		git_pack_entry_find(e, last_found, oid, GIT_OID_HEXSZ) == 0)
+		git_pack_entry_find(e, last_found, oid, GIT_OID_SHA1_HEXSIZE) == 0)
 		return 0;
 
 	git_vector_foreach(&backend->packs, i, p) {
 		if (p == last_found)
 			continue;
 
-		if (git_pack_entry_find(e, p, oid, GIT_OID_HEXSZ) == 0) {
+		if (git_pack_entry_find(e, p, oid, GIT_OID_SHA1_HEXSIZE) == 0) {
 			backend->last_found = p;
 			return 0;
 		}
 	}
 
 	return git_odb__error_notfound(
-		"failed to find pack entry", oid, GIT_OID_HEXSZ);
+		"failed to find pack entry", oid, GIT_OID_SHA1_HEXSIZE);
 }
 
 static int pack_entry_find_prefix(
@@ -605,7 +605,7 @@ static int pack_backend__read_prefix(
 	if (len < GIT_OID_MINPREFIXLEN)
 		error = git_odb__error_ambiguous("prefix length too short");
 
-	else if (len >= GIT_OID_HEXSZ) {
+	else if (len >= GIT_OID_SHA1_HEXSIZE) {
 		/* We can fall back to regular read method */
 		error = pack_backend__read(buffer_p, len_p, type_p, backend, short_oid);
 		if (!error)
diff --git a/src/libgit2/oid.c b/src/libgit2/oid.c
index fb92174..a66047d 100644
--- a/src/libgit2/oid.c
+++ b/src/libgit2/oid.c
@@ -39,10 +39,10 @@ int git_oid_fromstrn(git_oid *out, const char *str, size_t length)
 	if (!length)
 		return oid_error_invalid("too short");
 
-	if (length > GIT_OID_HEXSZ)
+	if (length > GIT_OID_SHA1_HEXSIZE)
 		return oid_error_invalid("too long");
 
-	memset(out->id, 0, GIT_OID_RAWSZ);
+	memset(out->id, 0, GIT_OID_SHA1_SIZE);
 
 	for (p = 0; p < length; p++) {
 		v = git__fromhex(str[p]);
@@ -62,7 +62,7 @@ int git_oid_fromstrp(git_oid *out, const char *str)
 
 int git_oid_fromstr(git_oid *out, const char *str)
 {
-	return git_oid_fromstrn(out, str, GIT_OID_HEXSZ);
+	return git_oid_fromstrn(out, str, GIT_OID_SHA1_HEXSIZE);
 }
 
 GIT_INLINE(char) *fmt_one(char *str, unsigned int val)
@@ -80,9 +80,9 @@ int git_oid_nfmt(char *str, size_t n, const git_oid *oid)
 		memset(str, 0, n);
 		return 0;
 	}
-	if (n > GIT_OID_HEXSZ) {
-		memset(&str[GIT_OID_HEXSZ], 0, n - GIT_OID_HEXSZ);
-		n = GIT_OID_HEXSZ;
+	if (n > GIT_OID_SHA1_HEXSIZE) {
+		memset(&str[GIT_OID_SHA1_HEXSIZE], 0, n - GIT_OID_SHA1_HEXSIZE);
+		n = GIT_OID_SHA1_HEXSIZE;
 	}
 
 	max_i = n / 2;
@@ -98,7 +98,7 @@ int git_oid_nfmt(char *str, size_t n, const git_oid *oid)
 
 int git_oid_fmt(char *str, const git_oid *oid)
 {
-	return git_oid_nfmt(str, GIT_OID_HEXSZ, oid);
+	return git_oid_nfmt(str, GIT_OID_SHA1_HEXSIZE, oid);
 }
 
 int git_oid_pathfmt(char *str, const git_oid *oid)
@@ -116,16 +116,16 @@ int git_oid_pathfmt(char *str, const git_oid *oid)
 char *git_oid_tostr_s(const git_oid *oid)
 {
 	char *str = GIT_THREADSTATE->oid_fmt;
-	git_oid_nfmt(str, GIT_OID_HEXSZ + 1, oid);
+	git_oid_nfmt(str, GIT_OID_SHA1_HEXSIZE + 1, oid);
 	return str;
 }
 
 char *git_oid_allocfmt(const git_oid *oid)
 {
-	char *str = git__malloc(GIT_OID_HEXSZ + 1);
+	char *str = git__malloc(GIT_OID_SHA1_HEXSIZE + 1);
 	if (!str)
 		return NULL;
-	git_oid_nfmt(str, GIT_OID_HEXSZ + 1, oid);
+	git_oid_nfmt(str, GIT_OID_SHA1_HEXSIZE + 1, oid);
 	return str;
 }
 
@@ -134,8 +134,8 @@ char *git_oid_tostr(char *out, size_t n, const git_oid *oid)
 	if (!out || n == 0)
 		return "";
 
-	if (n > GIT_OID_HEXSZ + 1)
-		n = GIT_OID_HEXSZ + 1;
+	if (n > GIT_OID_SHA1_HEXSIZE + 1)
+		n = GIT_OID_SHA1_HEXSIZE + 1;
 
 	git_oid_nfmt(out, n - 1, oid); /* allow room for terminating NUL */
 	out[n - 1] = '\0';
@@ -147,7 +147,7 @@ int git_oid__parse(
 	git_oid *oid, const char **buffer_out,
 	const char *buffer_end, const char *header)
 {
-	const size_t sha_len = GIT_OID_HEXSZ;
+	const size_t sha_len = GIT_OID_SHA1_HEXSIZE;
 	const size_t header_len = strlen(header);
 
 	const char *buffer = *buffer_out;
@@ -171,11 +171,11 @@ int git_oid__parse(
 
 void git_oid__writebuf(git_str *buf, const char *header, const git_oid *oid)
 {
-	char hex_oid[GIT_OID_HEXSZ];
+	char hex_oid[GIT_OID_SHA1_HEXSIZE];
 
 	git_oid_fmt(hex_oid, oid);
 	git_str_puts(buf, header);
-	git_str_put(buf, hex_oid, GIT_OID_HEXSZ);
+	git_str_put(buf, hex_oid, GIT_OID_SHA1_HEXSIZE);
 	git_str_putc(buf, '\n');
 }
 
@@ -211,7 +211,7 @@ int git_oid_strcmp(const git_oid *oid_a, const char *str)
 	unsigned char strval;
 	int hexval;
 
-	for (a = oid_a->id; *str && (a - oid_a->id) < GIT_OID_RAWSZ; ++a) {
+	for (a = oid_a->id; *str && (a - oid_a->id) < GIT_OID_SHA1_SIZE; ++a) {
 		if ((hexval = git__fromhex(*str++)) < 0)
 			return -1;
 		strval = (unsigned char)(hexval << 4);
@@ -236,7 +236,7 @@ int git_oid_is_zero(const git_oid *oid_a)
 {
 	const unsigned char *a = oid_a->id;
 	unsigned int i;
-	for (i = 0; i < GIT_OID_RAWSZ; ++i, ++a)
+	for (i = 0; i < GIT_OID_SHA1_SIZE; ++i, ++a)
 		if (*a != 0)
 			return 0;
 	return 1;
@@ -393,7 +393,7 @@ int git_oid_shorten_add(git_oid_shorten *os, const char *text_oid)
 	idx = 0;
 	is_leaf = false;
 
-	for (i = 0; i < GIT_OID_HEXSZ; ++i) {
+	for (i = 0; i < GIT_OID_SHA1_HEXSIZE; ++i) {
 		int c = git__fromhex(text_oid[i]);
 		trie_node *node;
 
diff --git a/src/libgit2/oid.h b/src/libgit2/oid.h
index abae9a4..b61a17f 100644
--- a/src/libgit2/oid.h
+++ b/src/libgit2/oid.h
@@ -30,8 +30,8 @@ GIT_INLINE(int) git_oid_raw_ncmp(
 	const unsigned char *sha2,
 	size_t len)
 {
-	if (len > GIT_OID_HEXSZ)
-		len = GIT_OID_HEXSZ;
+	if (len > GIT_OID_SHA1_HEXSIZE)
+		len = GIT_OID_SHA1_HEXSIZE;
 
 	while (len > 1) {
 		if (*sha1 != *sha2)
@@ -52,14 +52,14 @@ GIT_INLINE(int) git_oid_raw_cmp(
 	const unsigned char *sha1,
 	const unsigned char *sha2)
 {
-	return memcmp(sha1, sha2, GIT_OID_RAWSZ);
+	return memcmp(sha1, sha2, GIT_OID_SHA1_SIZE);
 }
 
 GIT_INLINE(int) git_oid_raw_cpy(
 	unsigned char *dst,
 	const unsigned char *src)
 {
-	memcpy(dst, src, GIT_OID_RAWSZ);
+	memcpy(dst, src, GIT_OID_SHA1_SIZE);
 	return 0;
 }
 
@@ -93,7 +93,7 @@ GIT_INLINE(bool) git_oid__is_hexstr(const char *str)
 			return false;
 	}
 
-	return (i == GIT_OID_HEXSZ);
+	return (i == GIT_OID_SHA1_HEXSIZE);
 }
 
 #endif
diff --git a/src/libgit2/pack-objects.c b/src/libgit2/pack-objects.c
index 1aa6731..0682316 100644
--- a/src/libgit2/pack-objects.c
+++ b/src/libgit2/pack-objects.c
@@ -347,8 +347,8 @@ static int write_object(
 		goto done;
 
 	if (type == GIT_OBJECT_REF_DELTA) {
-		if ((error = write_cb(po->delta->id.id, GIT_OID_RAWSZ, cb_data)) < 0 ||
-			(error = git_hash_update(&pb->ctx, po->delta->id.id, GIT_OID_RAWSZ)) < 0)
+		if ((error = write_cb(po->delta->id.id, GIT_OID_SHA1_SIZE, cb_data)) < 0 ||
+			(error = git_hash_update(&pb->ctx, po->delta->id.id, GIT_OID_SHA1_SIZE)) < 0)
 			goto done;
 	}
 
@@ -668,7 +668,7 @@ static int write_pack(git_packbuilder *pb,
 	if ((error = git_hash_final(entry_oid.id, &pb->ctx)) < 0)
 		goto done;
 
-	error = write_cb(entry_oid.id, GIT_OID_RAWSZ, cb_data);
+	error = write_cb(entry_oid.id, GIT_OID_SHA1_SIZE, cb_data);
 
 done:
 	/* if callback cancelled writing, we must still free delta_data */
diff --git a/src/libgit2/pack.c b/src/libgit2/pack.c
index 16fe378..9559374 100644
--- a/src/libgit2/pack.c
+++ b/src/libgit2/pack.c
@@ -32,7 +32,7 @@ static int packfile_unpack_compressed(
  * Throws GIT_EAMBIGUOUSOIDPREFIX if short oid
  * is ambiguous within the pack.
  * This method assumes that len is between
- * GIT_OID_MINPREFIXLEN and GIT_OID_HEXSZ.
+ * GIT_OID_MINPREFIXLEN and GIT_OID_SHA1_HEXSIZE.
  */
 static int pack_entry_find_offset(
 		off64_t *offset_out,
@@ -1025,7 +1025,7 @@ int get_delta_base(
 		}
 
 		/* The base entry _must_ be in the same pack */
-		if (pack_entry_find_offset(&base_offset, &unused, p, &base_oid, GIT_OID_HEXSZ) < 0)
+		if (pack_entry_find_offset(&base_offset, &unused, p, &base_oid, GIT_OID_SHA1_HEXSIZE) < 0)
 			return packfile_error("base entry delta is not in the same pack");
 		*curpos += 20;
 	} else
@@ -1083,7 +1083,7 @@ static int packfile_open_locked(struct git_pack_file *p)
 {
 	struct stat st;
 	struct git_pack_header hdr;
-	unsigned char sha1[GIT_OID_RAWSZ];
+	unsigned char sha1[GIT_OID_SHA1_SIZE];
 	unsigned char *idx_sha1;
 
 	if (pack_index_open_locked(p) < 0)
@@ -1131,7 +1131,7 @@ static int packfile_open_locked(struct git_pack_file *p)
 
 	/* Verify the pack matches its index. */
 	if (p->num_objects != ntohl(hdr.hdr_entries) ||
-	    p_pread(p->mwf.fd, sha1, GIT_OID_RAWSZ, p->mwf.size - GIT_OID_RAWSZ) < 0)
+	    p_pread(p->mwf.fd, sha1, GIT_OID_SHA1_SIZE, p->mwf.size - GIT_OID_SHA1_SIZE) < 0)
 		goto cleanup;
 
 	idx_sha1 = ((unsigned char *)p->index_map.data) + p->index_map.len - 40;
@@ -1541,7 +1541,7 @@ static int pack_entry_find_offset(
 		}
 	}
 
-	if (found && len != GIT_OID_HEXSZ && pos + 1 < (int)p->num_objects) {
+	if (found && len != GIT_OID_SHA1_HEXSIZE && pos + 1 < (int)p->num_objects) {
 		/* Check for ambiguousity */
 		const unsigned char *next = current + stride;
 
@@ -1570,9 +1570,9 @@ static int pack_entry_find_offset(
 
 #ifdef INDEX_DEBUG_LOOKUP
 	{
-		unsigned char hex_sha1[GIT_OID_HEXSZ + 1];
+		unsigned char hex_sha1[GIT_OID_SHA1_HEXSIZE + 1];
 		git_oid_fmt(hex_sha1, found_oid);
-		hex_sha1[GIT_OID_HEXSZ] = '\0';
+		hex_sha1[GIT_OID_SHA1_HEXSIZE] = '\0';
 		printf("found lo=%d %s\n", lo, hex_sha1);
 	}
 #endif
@@ -1594,7 +1594,7 @@ int git_pack_entry_find(
 
 	GIT_ASSERT_ARG(p);
 
-	if (len == GIT_OID_HEXSZ && p->num_bad_objects) {
+	if (len == GIT_OID_SHA1_HEXSIZE && p->num_bad_objects) {
 		unsigned i;
 		for (i = 0; i < p->num_bad_objects; i++)
 			if (git_oid__cmp(short_oid, &p->bad_object_sha1[i]) == 0)
diff --git a/src/libgit2/parse.c b/src/libgit2/parse.c
index 0a10758..7527b55 100644
--- a/src/libgit2/parse.c
+++ b/src/libgit2/parse.c
@@ -103,11 +103,11 @@ int git_parse_advance_digit(int64_t *out, git_parse_ctx *ctx, int base)
 
 int git_parse_advance_oid(git_oid *out, git_parse_ctx *ctx)
 {
-	if (ctx->line_len < GIT_OID_HEXSZ)
+	if (ctx->line_len < GIT_OID_SHA1_HEXSIZE)
 		return -1;
-	if ((git_oid_fromstrn(out, ctx->line, GIT_OID_HEXSZ)) < 0)
+	if ((git_oid_fromstrn(out, ctx->line, GIT_OID_SHA1_HEXSIZE)) < 0)
 		return -1;
-	git_parse_advance_chars(ctx, GIT_OID_HEXSZ);
+	git_parse_advance_chars(ctx, GIT_OID_SHA1_HEXSIZE);
 	return 0;
 }
 
diff --git a/src/libgit2/patch_parse.c b/src/libgit2/patch_parse.c
index 78cd962..0ca1e43 100644
--- a/src/libgit2/patch_parse.c
+++ b/src/libgit2/patch_parse.c
@@ -168,12 +168,12 @@ static int parse_header_oid(
 {
 	size_t len;
 
-	for (len = 0; len < ctx->parse_ctx.line_len && len < GIT_OID_HEXSZ; len++) {
+	for (len = 0; len < ctx->parse_ctx.line_len && len < GIT_OID_SHA1_HEXSIZE; len++) {
 		if (!git__isxdigit(ctx->parse_ctx.line[len]))
 			break;
 	}
 
-	if (len < GIT_OID_MINPREFIXLEN || len > GIT_OID_HEXSZ ||
+	if (len < GIT_OID_MINPREFIXLEN || len > GIT_OID_SHA1_HEXSIZE ||
 		git_oid_fromstrn(oid, ctx->parse_ctx.line, len) < 0)
 		return git_parse_err("invalid hex formatted object id at line %"PRIuZ,
 			ctx->parse_ctx.line_num);
diff --git a/src/libgit2/rebase.c b/src/libgit2/rebase.c
index 6f01d39..f0d528d 100644
--- a/src/libgit2/rebase.c
+++ b/src/libgit2/rebase.c
@@ -171,7 +171,7 @@ GIT_INLINE(int) rebase_readoid(
 	if ((error = rebase_readfile(str_out, state_path, filename)) < 0)
 		return error;
 
-	if (str_out->size != GIT_OID_HEXSZ || git_oid_fromstr(out, str_out->ptr) < 0) {
+	if (str_out->size != GIT_OID_SHA1_HEXSIZE || git_oid_fromstr(out, str_out->ptr) < 0) {
 		git_error_set(GIT_ERROR_REBASE, "the file '%s' contains an invalid object ID", filename);
 		return -1;
 	}
@@ -442,7 +442,7 @@ static const char *rebase_onto_name(const git_annotated_commit *onto)
 static int rebase_setupfiles_merge(git_rebase *rebase)
 {
 	git_str commit_filename = GIT_STR_INIT;
-	char id_str[GIT_OID_HEXSZ];
+	char id_str[GIT_OID_SHA1_HEXSIZE];
 	git_rebase_operation *operation;
 	size_t i;
 	int error = 0;
@@ -460,7 +460,7 @@ static int rebase_setupfiles_merge(git_rebase *rebase)
 		git_oid_fmt(id_str, &operation->id);
 
 		if ((error = rebase_setupfile(rebase, commit_filename.ptr, 0,
-				"%.*s\n", GIT_OID_HEXSZ, id_str)) < 0)
+				"%.*s\n", GIT_OID_SHA1_HEXSIZE, id_str)) < 0)
 			goto done;
 	}
 
@@ -471,7 +471,7 @@ done:
 
 static int rebase_setupfiles(git_rebase *rebase)
 {
-	char onto[GIT_OID_HEXSZ], orig_head[GIT_OID_HEXSZ];
+	char onto[GIT_OID_SHA1_HEXSIZE], orig_head[GIT_OID_SHA1_HEXSIZE];
 	const char *orig_head_name;
 
 	git_oid_fmt(onto, &rebase->onto_id);
@@ -487,8 +487,8 @@ static int rebase_setupfiles(git_rebase *rebase)
 
 	if (git_repository__set_orig_head(rebase->repo, &rebase->orig_head_id) < 0 ||
 		rebase_setupfile(rebase, HEAD_NAME_FILE, 0, "%s\n", orig_head_name) < 0 ||
-		rebase_setupfile(rebase, ONTO_FILE, 0, "%.*s\n", GIT_OID_HEXSZ, onto) < 0 ||
-		rebase_setupfile(rebase, ORIG_HEAD_FILE, 0, "%.*s\n", GIT_OID_HEXSZ, orig_head) < 0 ||
+		rebase_setupfile(rebase, ONTO_FILE, 0, "%.*s\n", GIT_OID_SHA1_HEXSIZE, onto) < 0 ||
+		rebase_setupfile(rebase, ORIG_HEAD_FILE, 0, "%.*s\n", GIT_OID_SHA1_HEXSIZE, orig_head) < 0 ||
 		rebase_setupfile(rebase, QUIET_FILE, 0, rebase->quiet ? "t\n" : "\n") < 0)
 		return -1;
 
@@ -803,7 +803,7 @@ static int rebase_next_merge(
 	git_indexwriter indexwriter = GIT_INDEXWRITER_INIT;
 	git_rebase_operation *operation;
 	git_checkout_options checkout_opts;
-	char current_idstr[GIT_OID_HEXSZ];
+	char current_idstr[GIT_OID_SHA1_HEXSIZE];
 	unsigned int parent_count;
 	int error;
 
@@ -832,7 +832,7 @@ static int rebase_next_merge(
 
 	if ((error = git_indexwriter_init_for_operation(&indexwriter, rebase->repo, &checkout_opts.checkout_strategy)) < 0 ||
 		(error = rebase_setupfile(rebase, MSGNUM_FILE, 0, "%" PRIuZ "\n", rebase->current+1)) < 0 ||
-		(error = rebase_setupfile(rebase, CURRENT_FILE, 0, "%.*s\n", GIT_OID_HEXSZ, current_idstr)) < 0 ||
+		(error = rebase_setupfile(rebase, CURRENT_FILE, 0, "%.*s\n", GIT_OID_SHA1_HEXSIZE, current_idstr)) < 0 ||
 		(error = git_merge_trees(&index, rebase->repo, parent_tree, head_tree, current_tree, &rebase->options.merge_options)) < 0 ||
 		(error = git_merge__check_result(rebase->repo, index)) < 0 ||
 		(error = git_checkout_index(rebase->repo, index, &checkout_opts)) < 0 ||
@@ -1092,7 +1092,7 @@ static int rebase_commit_merge(
 	git_reference *head = NULL;
 	git_commit *head_commit = NULL, *commit = NULL;
 	git_index *index = NULL;
-	char old_idstr[GIT_OID_HEXSZ], new_idstr[GIT_OID_HEXSZ];
+	char old_idstr[GIT_OID_SHA1_HEXSIZE], new_idstr[GIT_OID_SHA1_HEXSIZE];
 	int error;
 
 	operation = git_array_get(rebase->operations, rebase->current);
@@ -1112,7 +1112,7 @@ static int rebase_commit_merge(
 	git_oid_fmt(new_idstr, git_commit_id(commit));
 
 	if ((error = rebase_setupfile(rebase, REWRITTEN_FILE, O_CREAT|O_WRONLY|O_APPEND,
-		"%.*s %.*s\n", GIT_OID_HEXSZ, old_idstr, GIT_OID_HEXSZ, new_idstr)) < 0)
+		"%.*s %.*s\n", GIT_OID_SHA1_HEXSIZE, old_idstr, GIT_OID_SHA1_HEXSIZE, new_idstr)) < 0)
 		goto done;
 
 	git_oid_cpy(commit_id, git_commit_id(commit));
@@ -1331,8 +1331,8 @@ static int rebase_copy_notes(
 		tostr = end+1;
 		*end = '\0';
 
-		if (strlen(fromstr) != GIT_OID_HEXSZ ||
-			strlen(tostr) != GIT_OID_HEXSZ ||
+		if (strlen(fromstr) != GIT_OID_SHA1_HEXSIZE ||
+			strlen(tostr) != GIT_OID_SHA1_HEXSIZE ||
 			git_oid_fromstr(&from, fromstr) < 0 ||
 			git_oid_fromstr(&to, tostr) < 0)
 			goto on_error;
@@ -1362,14 +1362,14 @@ static int return_to_orig_head(git_rebase *rebase)
 	git_reference *terminal_ref = NULL, *branch_ref = NULL, *head_ref = NULL;
 	git_commit *terminal_commit = NULL;
 	git_str branch_msg = GIT_STR_INIT, head_msg = GIT_STR_INIT;
-	char onto[GIT_OID_HEXSZ];
+	char onto[GIT_OID_SHA1_HEXSIZE];
 	int error = 0;
 
 	git_oid_fmt(onto, &rebase->onto_id);
 
 	if ((error = git_str_printf(&branch_msg,
 			"rebase finished: %s onto %.*s",
-			rebase->orig_head_name, GIT_OID_HEXSZ, onto)) == 0 &&
+			rebase->orig_head_name, GIT_OID_SHA1_HEXSIZE, onto)) == 0 &&
 		(error = git_str_printf(&head_msg,
 			"rebase finished: returning to %s",
 			rebase->orig_head_name)) == 0 &&
diff --git a/src/libgit2/refdb_fs.c b/src/libgit2/refdb_fs.c
index 0f49b16..d7b0da1 100644
--- a/src/libgit2/refdb_fs.c
+++ b/src/libgit2/refdb_fs.c
@@ -160,7 +160,7 @@ static int packed_reload(refdb_fs_backend *backend)
 
 		if (git_oid_fromstr(&oid, scan) < 0)
 			goto parse_failed;
-		scan += GIT_OID_HEXSZ;
+		scan += GIT_OID_SHA1_HEXSIZE;
 
 		if (*scan++ != ' ')
 			goto parse_failed;
@@ -181,7 +181,7 @@ static int packed_reload(refdb_fs_backend *backend)
 		if (*scan == '^') {
 			if (git_oid_fromstr(&oid, scan + 1) < 0)
 				goto parse_failed;
-			scan += GIT_OID_HEXSZ + 1;
+			scan += GIT_OID_SHA1_HEXSIZE + 1;
 
 			if (scan < eof) {
 				if (!(eol = strchr(scan, '\n')))
@@ -218,7 +218,7 @@ static int loose_parse_oid(
 {
 	const char *str = git_str_cstr(file_content);
 
-	if (git_str_len(file_content) < GIT_OID_HEXSZ)
+	if (git_str_len(file_content) < GIT_OID_SHA1_HEXSIZE)
 		goto corrupted;
 
 	/* we need to get 40 OID characters from the file */
@@ -226,7 +226,7 @@ static int loose_parse_oid(
 		goto corrupted;
 
 	/* If the file is longer than 40 chars, the 41st must be a space */
-	str += GIT_OID_HEXSZ;
+	str += GIT_OID_SHA1_HEXSIZE;
 	if (*str == '\0' || git__isspace(*str))
 		return 0;
 
@@ -622,12 +622,12 @@ cmp_record_to_refname(const char *rec, size_t data_end, const char *ref_name)
 	int cmp_val;
 	const char *end;
 
-	rec += GIT_OID_HEXSZ + 1; /* <oid> + space */
-	if (data_end < GIT_OID_HEXSZ + 3) {
+	rec += GIT_OID_SHA1_HEXSIZE + 1; /* <oid> + space */
+	if (data_end < GIT_OID_SHA1_HEXSIZE + 3) {
 		/* an incomplete (corrupt) record is treated as less than ref_name */
 		return -1;
 	}
-	data_end -= GIT_OID_HEXSZ + 1;
+	data_end -= GIT_OID_SHA1_HEXSIZE + 1;
 
 	end = memchr(rec, '\n', data_end);
 	if (end)
@@ -708,11 +708,11 @@ static int packed_lookup(
 			const char *eol;
 			git_oid oid, peel, *peel_ptr = NULL;
 
-			if (data_end - rec < GIT_OID_HEXSZ ||
+			if (data_end - rec < GIT_OID_SHA1_HEXSIZE ||
 			    git_oid_fromstr(&oid, rec) < 0) {
 				goto parse_failed;
 			}
-			rec += GIT_OID_HEXSZ + 1;
+			rec += GIT_OID_SHA1_HEXSIZE + 1;
 			if (!(eol = memchr(rec, '\n', data_end - rec))) {
 				goto parse_failed;
 			}
@@ -724,7 +724,7 @@ static int packed_lookup(
 
 				if (*rec == '^') {
 					rec++;
-					if (data_end - rec < GIT_OID_HEXSZ ||
+					if (data_end - rec < GIT_OID_SHA1_HEXSIZE ||
 						git_oid_fromstr(&peel, rec) < 0) {
 						goto parse_failed;
 					}
@@ -1108,7 +1108,7 @@ static int loose_commit(git_filebuf *file, const git_reference *ref)
 	GIT_ASSERT_ARG(ref);
 
 	if (ref->type == GIT_REFERENCE_DIRECT) {
-		char oid[GIT_OID_HEXSZ + 1];
+		char oid[GIT_OID_SHA1_HEXSIZE + 1];
 		git_oid_nfmt(oid, sizeof(oid), &ref->target.oid);
 
 		git_filebuf_printf(file, "%s\n", oid);
@@ -1224,7 +1224,7 @@ static int packed_find_peel(refdb_fs_backend *backend, struct packref *ref)
  */
 static int packed_write_ref(struct packref *ref, git_filebuf *file)
 {
-	char oid[GIT_OID_HEXSZ + 1];
+	char oid[GIT_OID_SHA1_HEXSIZE + 1];
 	git_oid_nfmt(oid, sizeof(oid), &ref->oid);
 
 	/*
@@ -1238,7 +1238,7 @@ static int packed_write_ref(struct packref *ref, git_filebuf *file)
 	 * The required peels have already been loaded into `ref->peel_target`.
 	 */
 	if (ref->flags & PACKREF_HAS_PEEL) {
-		char peel[GIT_OID_HEXSZ + 1];
+		char peel[GIT_OID_SHA1_HEXSIZE + 1];
 		git_oid_nfmt(peel, sizeof(peel), &ref->peel);
 
 		if (git_filebuf_printf(file, "%s %s\n^%s\n", oid, ref->name, peel) < 0)
@@ -2086,11 +2086,11 @@ static int serialize_reflog_entry(
 	const git_signature *committer,
 	const char *msg)
 {
-	char raw_old[GIT_OID_HEXSZ+1];
-	char raw_new[GIT_OID_HEXSZ+1];
+	char raw_old[GIT_OID_SHA1_HEXSIZE+1];
+	char raw_new[GIT_OID_SHA1_HEXSIZE+1];
 
-	git_oid_tostr(raw_old, GIT_OID_HEXSZ+1, oid_old);
-	git_oid_tostr(raw_new, GIT_OID_HEXSZ+1, oid_new);
+	git_oid_tostr(raw_old, GIT_OID_SHA1_HEXSIZE+1, oid_old);
+	git_oid_tostr(raw_new, GIT_OID_SHA1_HEXSIZE+1, oid_new);
 
 	git_str_clear(buf);
 
diff --git a/src/libgit2/reflog.h b/src/libgit2/reflog.h
index 8c38959..50d1056 100644
--- a/src/libgit2/reflog.h
+++ b/src/libgit2/reflog.h
@@ -16,7 +16,7 @@
 #define GIT_REFLOG_DIR_MODE 0777
 #define GIT_REFLOG_FILE_MODE 0666
 
-#define GIT_REFLOG_SIZE_MIN (2*GIT_OID_HEXSZ+2+17)
+#define GIT_REFLOG_SIZE_MIN (2*GIT_OID_SHA1_HEXSIZE+2+17)
 
 struct git_reflog_entry {
 	git_oid oid_old;
diff --git a/src/libgit2/repository.c b/src/libgit2/repository.c
index d248431..1312ccc 100644
--- a/src/libgit2/repository.c
+++ b/src/libgit2/repository.c
@@ -240,7 +240,7 @@ GIT_INLINE(int) validate_repo_path(git_str *path)
 	 */
 	static size_t suffix_len =
 		CONST_STRLEN("objects/pack/pack-.pack.lock") +
-		GIT_OID_HEXSZ;
+		GIT_OID_SHA1_HEXSIZE;
 
 	return git_fs_path_validate_str_length_with_suffix(
 		path, suffix_len);
@@ -2866,14 +2866,14 @@ int git_repository__set_orig_head(git_repository *repo, const git_oid *orig_head
 {
 	git_filebuf file = GIT_FILEBUF_INIT;
 	git_str file_path = GIT_STR_INIT;
-	char orig_head_str[GIT_OID_HEXSZ];
+	char orig_head_str[GIT_OID_SHA1_HEXSIZE];
 	int error = 0;
 
 	git_oid_fmt(orig_head_str, orig_head);
 
 	if ((error = git_str_joinpath(&file_path, repo->gitdir, GIT_ORIG_HEAD_FILE)) == 0 &&
 		(error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_CREATE_LEADING_DIRS, GIT_MERGE_FILE_MODE)) == 0 &&
-		(error = git_filebuf_printf(&file, "%.*s\n", GIT_OID_HEXSZ, orig_head_str)) == 0)
+		(error = git_filebuf_printf(&file, "%.*s\n", GIT_OID_SHA1_HEXSIZE, orig_head_str)) == 0)
 		error = git_filebuf_commit(&file);
 
 	if (error < 0)
diff --git a/src/libgit2/reset.c b/src/libgit2/reset.c
index e0d942e..9574819 100644
--- a/src/libgit2/reset.c
+++ b/src/libgit2/reset.c
@@ -188,9 +188,9 @@ int git_reset(
 	git_reset_t reset_type,
 	const git_checkout_options *checkout_opts)
 {
-	char to[GIT_OID_HEXSZ + 1];
+	char to[GIT_OID_SHA1_HEXSIZE + 1];
 
-	git_oid_tostr(to, GIT_OID_HEXSZ + 1, git_object_id(target));
+	git_oid_tostr(to, GIT_OID_SHA1_HEXSIZE + 1, git_object_id(target));
 	return reset(repo, target, to, reset_type, checkout_opts);
 }
 
diff --git a/src/libgit2/revert.c b/src/libgit2/revert.c
index d6ab6ae..1106dfe 100644
--- a/src/libgit2/revert.c
+++ b/src/libgit2/revert.c
@@ -107,10 +107,10 @@ static int revert_state_cleanup(git_repository *repo)
 
 static int revert_seterr(git_commit *commit, const char *fmt)
 {
-	char commit_oidstr[GIT_OID_HEXSZ + 1];
+	char commit_oidstr[GIT_OID_SHA1_HEXSIZE + 1];
 
 	git_oid_fmt(commit_oidstr, git_commit_id(commit));
-	commit_oidstr[GIT_OID_HEXSZ] = '\0';
+	commit_oidstr[GIT_OID_SHA1_HEXSIZE] = '\0';
 
 	git_error_set(GIT_ERROR_REVERT, fmt, commit_oidstr);
 
@@ -176,7 +176,7 @@ int git_revert(
 	git_revert_options opts;
 	git_reference *our_ref = NULL;
 	git_commit *our_commit = NULL;
-	char commit_oidstr[GIT_OID_HEXSZ + 1];
+	char commit_oidstr[GIT_OID_SHA1_HEXSIZE + 1];
 	const char *commit_msg;
 	git_str their_label = GIT_STR_INIT;
 	git_index *index = NULL;
@@ -192,7 +192,7 @@ int git_revert(
 		return error;
 
 	git_oid_fmt(commit_oidstr, git_commit_id(commit));
-	commit_oidstr[GIT_OID_HEXSZ] = '\0';
+	commit_oidstr[GIT_OID_SHA1_HEXSIZE] = '\0';
 
 	if ((commit_msg = git_commit_summary(commit)) == NULL) {
 		error = -1;
diff --git a/src/libgit2/revparse.c b/src/libgit2/revparse.c
index 9bc28e9..3226e28 100644
--- a/src/libgit2/revparse.c
+++ b/src/libgit2/revparse.c
@@ -29,7 +29,7 @@ static int maybe_sha(git_object **out, git_repository *repo, const char *spec)
 {
 	size_t speclen = strlen(spec);
 
-	if (speclen != GIT_OID_HEXSZ)
+	if (speclen != GIT_OID_SHA1_HEXSIZE)
 		return GIT_ENOTFOUND;
 
 	return maybe_sha_or_abbrev(out, repo, spec, speclen);
@@ -110,7 +110,7 @@ static int revparse_lookup_object(
 	if (error != GIT_ENOTFOUND)
 		return error;
 
-	if ((strlen(spec) < GIT_OID_HEXSZ) &&
+	if ((strlen(spec) < GIT_OID_SHA1_HEXSIZE) &&
 		((error = maybe_abbrev(object_out, repo, spec)) != GIT_ENOTFOUND))
 			return error;
 
diff --git a/src/libgit2/threadstate.h b/src/libgit2/threadstate.h
index c10f26b..f9e7ba7 100644
--- a/src/libgit2/threadstate.h
+++ b/src/libgit2/threadstate.h
@@ -13,7 +13,7 @@ typedef struct {
 	git_error *last_error;
 	git_error error_t;
 	git_str error_buf;
-	char oid_fmt[GIT_OID_HEXSZ+1];
+	char oid_fmt[GIT_OID_SHA1_HEXSIZE+1];
 } git_threadstate;
 
 extern int git_threadstate_global_init(void);
diff --git a/src/libgit2/transports/smart_pkt.c b/src/libgit2/transports/smart_pkt.c
index b42edd0..3b0c344 100644
--- a/src/libgit2/transports/smart_pkt.c
+++ b/src/libgit2/transports/smart_pkt.c
@@ -53,10 +53,10 @@ static int ack_pkt(git_pkt **out, const char *line, size_t len)
 	line += 4;
 	len -= 4;
 
-	if (len < GIT_OID_HEXSZ || git_oid_fromstr(&pkt->oid, line) < 0)
+	if (len < GIT_OID_SHA1_HEXSIZE || git_oid_fromstr(&pkt->oid, line) < 0)
 		goto out_err;
-	line += GIT_OID_HEXSZ;
-	len -= GIT_OID_HEXSZ;
+	line += GIT_OID_SHA1_HEXSIZE;
+	len -= GIT_OID_SHA1_HEXSIZE;
 
 	if (len && line[0] == ' ') {
 		line++;
@@ -222,10 +222,10 @@ static int ref_pkt(git_pkt **out, const char *line, size_t len)
 	GIT_ERROR_CHECK_ALLOC(pkt);
 	pkt->type = GIT_PKT_REF;
 
-	if (len < GIT_OID_HEXSZ || git_oid_fromstr(&pkt->head.oid, line) < 0)
+	if (len < GIT_OID_SHA1_HEXSIZE || git_oid_fromstr(&pkt->head.oid, line) < 0)
 		goto out_err;
-	line += GIT_OID_HEXSZ;
-	len -= GIT_OID_HEXSZ;
+	line += GIT_OID_SHA1_HEXSIZE;
+	len -= GIT_OID_SHA1_HEXSIZE;
 
 	if (git__prefixncmp(line, len, " "))
 		goto out_err;
@@ -530,7 +530,7 @@ int git_pkt_buffer_flush(git_str *buf)
 static int buffer_want_with_caps(const git_remote_head *head, transport_smart_caps *caps, git_str *buf)
 {
 	git_str str = GIT_STR_INIT;
-	char oid[GIT_OID_HEXSZ +1] = {0};
+	char oid[GIT_OID_SHA1_HEXSIZE +1] = {0};
 	size_t len;
 
 	/* Prefer multi_ack_detailed */
@@ -557,7 +557,7 @@ static int buffer_want_with_caps(const git_remote_head *head, transport_smart_ca
 	if (git_str_oom(&str))
 		return -1;
 
-	len = strlen("XXXXwant ") + GIT_OID_HEXSZ + 1 /* NUL */ +
+	len = strlen("XXXXwant ") + GIT_OID_SHA1_HEXSIZE + 1 /* NUL */ +
 		 git_str_len(&str) + 1 /* LF */;
 
 	if (len > 0xffff) {
@@ -605,7 +605,7 @@ int git_pkt_buffer_wants(
 	}
 
 	for (; i < count; ++i) {
-		char oid[GIT_OID_HEXSZ];
+		char oid[GIT_OID_SHA1_HEXSIZE];
 
 		head = refs[i];
 		if (head->local)
@@ -613,7 +613,7 @@ int git_pkt_buffer_wants(
 
 		git_oid_fmt(oid, &head->oid);
 		git_str_put(buf, pkt_want_prefix, strlen(pkt_want_prefix));
-		git_str_put(buf, oid, GIT_OID_HEXSZ);
+		git_str_put(buf, oid, GIT_OID_SHA1_HEXSIZE);
 		git_str_putc(buf, '\n');
 		if (git_str_oom(buf))
 			return -1;
@@ -624,7 +624,7 @@ int git_pkt_buffer_wants(
 
 int git_pkt_buffer_have(git_oid *oid, git_str *buf)
 {
-	char oidhex[GIT_OID_HEXSZ + 1];
+	char oidhex[GIT_OID_SHA1_HEXSIZE + 1];
 
 	memset(oidhex, 0x0, sizeof(oidhex));
 	git_oid_fmt(oidhex, oid);
diff --git a/src/libgit2/transports/smart_protocol.c b/src/libgit2/transports/smart_protocol.c
index 8cf0271..09778b3 100644
--- a/src/libgit2/transports/smart_protocol.c
+++ b/src/libgit2/transports/smart_protocol.c
@@ -643,12 +643,12 @@ static int gen_pktline(git_str *buf, git_push *push)
 {
 	push_spec *spec;
 	size_t i, len;
-	char old_id[GIT_OID_HEXSZ+1], new_id[GIT_OID_HEXSZ+1];
+	char old_id[GIT_OID_SHA1_HEXSIZE+1], new_id[GIT_OID_SHA1_HEXSIZE+1];
 
-	old_id[GIT_OID_HEXSZ] = '\0'; new_id[GIT_OID_HEXSZ] = '\0';
+	old_id[GIT_OID_SHA1_HEXSIZE] = '\0'; new_id[GIT_OID_SHA1_HEXSIZE] = '\0';
 
 	git_vector_foreach(&push->specs, i, spec) {
-		len = 2*GIT_OID_HEXSZ + 7 + strlen(spec->refspec.dst);
+		len = 2*GIT_OID_SHA1_HEXSIZE + 7 + strlen(spec->refspec.dst);
 
 		if (i == 0) {
 			++len; /* '\0' */
@@ -1020,7 +1020,7 @@ int git_smart__push(git_transport *transport, git_push *push)
 #ifdef PUSH_DEBUG
 {
 	git_remote_head *head;
-	char hex[GIT_OID_HEXSZ+1]; hex[GIT_OID_HEXSZ] = '\0';
+	char hex[GIT_OID_SHA1_HEXSIZE+1]; hex[GIT_OID_SHA1_HEXSIZE] = '\0';
 
 	git_vector_foreach(&push->remote->refs, i, head) {
 		git_oid_fmt(hex, &head->oid);
diff --git a/src/libgit2/tree-cache.c b/src/libgit2/tree-cache.c
index cd69e7b..966e7df 100644
--- a/src/libgit2/tree-cache.c
+++ b/src/libgit2/tree-cache.c
@@ -111,11 +111,11 @@ static int read_tree_internal(git_tree_cache **out,
 	/* The SHA1 is only there if it's not invalidated */
 	if (tree->entry_count >= 0) {
 		/* 160-bit SHA-1 for this tree and it's children */
-		if (buffer + GIT_OID_RAWSZ > buffer_end)
+		if (buffer + GIT_OID_SHA1_SIZE > buffer_end)
 			goto corrupted;
 
 		git_oid_fromraw(&tree->oid, (const unsigned char *)buffer);
-		buffer += GIT_OID_RAWSZ;
+		buffer += GIT_OID_SHA1_SIZE;
 	}
 
 	/* Parse children: */
@@ -263,7 +263,7 @@ static void write_tree(git_str *out, git_tree_cache *tree)
 	git_str_printf(out, "%s%c%"PRIdZ" %"PRIuZ"\n", tree->name, 0, tree->entry_count, tree->children_count);
 
 	if (tree->entry_count != -1)
-		git_str_put(out, (char *)&tree->oid.id, GIT_OID_RAWSZ);
+		git_str_put(out, (char *)&tree->oid.id, GIT_OID_SHA1_SIZE);
 
 	for (i = 0; i < tree->children_count; i++)
 		write_tree(out, tree->children[i]);
diff --git a/src/libgit2/tree.c b/src/libgit2/tree.c
index a5371fd..9d3c67d 100644
--- a/src/libgit2/tree.c
+++ b/src/libgit2/tree.c
@@ -89,7 +89,7 @@ static git_tree_entry *alloc_entry(const char *filename, size_t filename_len, co
 
 	if (GIT_ADD_SIZET_OVERFLOW(&tree_len, sizeof(git_tree_entry), filename_len) ||
 	    GIT_ADD_SIZET_OVERFLOW(&tree_len, tree_len, 1) ||
-	    GIT_ADD_SIZET_OVERFLOW(&tree_len, tree_len, GIT_OID_RAWSZ))
+	    GIT_ADD_SIZET_OVERFLOW(&tree_len, tree_len, GIT_OID_SHA1_SIZE))
 		return NULL;
 
 	entry = git__calloc(1, tree_len);
@@ -414,7 +414,7 @@ int git_tree__parse_raw(void *_tree, const char *data, size_t size)
 		if ((filename_len = nul - buffer) == 0 || filename_len > UINT16_MAX)
 			return tree_parse_error("failed to parse tree: can't parse filename", NULL);
 
-		if ((buffer_end - (nul + 1)) < GIT_OID_RAWSZ)
+		if ((buffer_end - (nul + 1)) < GIT_OID_SHA1_SIZE)
 			return tree_parse_error("failed to parse tree: can't parse OID", NULL);
 
 		/* Allocate the entry */
@@ -429,7 +429,7 @@ int git_tree__parse_raw(void *_tree, const char *data, size_t size)
 		}
 
 		buffer += filename_len + 1;
-		buffer += GIT_OID_RAWSZ;
+		buffer += GIT_OID_SHA1_SIZE;
 	}
 
 	return 0;
@@ -529,7 +529,7 @@ static int git_treebuilder__write_with_buffer(
 
 		git_str_printf(buf, "%o ", entry->attr);
 		git_str_put(buf, entry->filename, entry->filename_len + 1);
-		git_str_put(buf, (char *)entry->oid.id, GIT_OID_RAWSZ);
+		git_str_put(buf, (char *)entry->oid.id, GIT_OID_SHA1_SIZE);
 
 		if (git_str_oom(buf)) {
 			error = -1;
diff --git a/tests/libgit2/blame/blame_helpers.c b/tests/libgit2/blame/blame_helpers.c
index 6b3ce67..8aeaa58 100644
--- a/tests/libgit2/blame/blame_helpers.c
+++ b/tests/libgit2/blame/blame_helpers.c
@@ -17,7 +17,7 @@ void hunk_message(size_t idx, const git_blame_hunk *hunk, const char *fmt, ...)
 void check_blame_hunk_index(git_repository *repo, git_blame *blame, int idx,
 		size_t start_line, size_t len, char boundary, const char *commit_id, const char *orig_path)
 {
-	char expected[GIT_OID_HEXSZ+1] = {0}, actual[GIT_OID_HEXSZ+1] = {0};
+	char expected[GIT_OID_SHA1_HEXSIZE+1] = {0}, actual[GIT_OID_SHA1_HEXSIZE+1] = {0};
 	const git_blame_hunk *hunk = git_blame_get_hunk_byindex(blame, idx);
 	cl_assert(hunk);
 
diff --git a/tests/libgit2/checkout/conflict.c b/tests/libgit2/checkout/conflict.c
index 4a9e4b9..3083894 100644
--- a/tests/libgit2/checkout/conflict.c
+++ b/tests/libgit2/checkout/conflict.c
@@ -49,7 +49,7 @@ static git_index *g_index;
 
 struct checkout_index_entry {
 	uint16_t mode;
-	char oid_str[GIT_OID_HEXSZ+1];
+	char oid_str[GIT_OID_SHA1_HEXSIZE+1];
 	int stage;
 	char path[128];
 };
diff --git a/tests/libgit2/core/oidmap.c b/tests/libgit2/core/oidmap.c
index 7f98287..6854e34 100644
--- a/tests/libgit2/core/oidmap.c
+++ b/tests/libgit2/core/oidmap.c
@@ -17,7 +17,7 @@ void test_core_oidmap__initialize(void)
 
 		test_oids[i].extra = i;
 
-		for (j = 0; j < GIT_OID_RAWSZ / 4; ++j) {
+		for (j = 0; j < GIT_OID_SHA1_SIZE / 4; ++j) {
 			test_oids[i].oid.id[j * 4    ] = (unsigned char)modi;
 			test_oids[i].oid.id[j * 4 + 1] = (unsigned char)(modi >> 8);
 			test_oids[i].oid.id[j * 4 + 2] = (unsigned char)(modi >> 16);
diff --git a/tests/libgit2/core/pool.c b/tests/libgit2/core/pool.c
index 5746e35..af13213 100644
--- a/tests/libgit2/core/pool.c
+++ b/tests/libgit2/core/pool.c
@@ -7,7 +7,7 @@ static char to_hex[] = "0123456789abcdef";
 void test_core_pool__oid(void)
 {
 	git_pool p;
-	char oid_hex[GIT_OID_HEXSZ];
+	char oid_hex[GIT_OID_SHA1_HEXSIZE];
 	git_oid *oid;
 	int i, j;
 
diff --git a/tests/libgit2/diff/binary.c b/tests/libgit2/diff/binary.c
index 4e71f39..284a1b1 100644
--- a/tests/libgit2/diff/binary.c
+++ b/tests/libgit2/diff/binary.c
@@ -100,7 +100,7 @@ void test_diff_binary__add(void)
 		"\n";
 
 	opts.flags = GIT_DIFF_SHOW_BINARY;
-	opts.id_abbrev = GIT_OID_HEXSZ;
+	opts.id_abbrev = GIT_OID_SHA1_HEXSIZE;
 
 	repo = cl_git_sandbox_init("diff_format_email");
 	test_patch(
@@ -183,7 +183,7 @@ void test_diff_binary__delete(void)
 		"\n";
 
 	opts.flags = GIT_DIFF_SHOW_BINARY;
-	opts.id_abbrev = GIT_OID_HEXSZ;
+	opts.id_abbrev = GIT_OID_SHA1_HEXSIZE;
 
 	repo = cl_git_sandbox_init("diff_format_email");
 	test_patch(
@@ -215,7 +215,7 @@ void test_diff_binary__delta(void)
 		"\n";
 
 	opts.flags = GIT_DIFF_SHOW_BINARY | GIT_DIFF_FORCE_BINARY;
-	opts.id_abbrev = GIT_OID_HEXSZ;
+	opts.id_abbrev = GIT_OID_SHA1_HEXSIZE;
 
 	repo = cl_git_sandbox_init("renames");
 	cl_git_pass(git_repository_index(&index, repo));
@@ -257,7 +257,7 @@ void test_diff_binary__delta_append(void)
 		"\n";
 
 	opts.flags = GIT_DIFF_SHOW_BINARY | GIT_DIFF_FORCE_BINARY;
-	opts.id_abbrev = GIT_OID_HEXSZ;
+	opts.id_abbrev = GIT_OID_SHA1_HEXSIZE;
 
 	repo = cl_git_sandbox_init("renames");
 	cl_git_pass(git_repository_index(&index, repo));
@@ -285,7 +285,7 @@ void test_diff_binary__empty_for_no_diff(void)
 	git_str actual = GIT_STR_INIT;
 
 	opts.flags = GIT_DIFF_SHOW_BINARY | GIT_DIFF_FORCE_BINARY;
-	opts.id_abbrev = GIT_OID_HEXSZ;
+	opts.id_abbrev = GIT_OID_SHA1_HEXSIZE;
 
 	repo = cl_git_sandbox_init("renames");
 
@@ -323,7 +323,7 @@ void test_diff_binary__index_to_workdir(void)
 		"\n";
 
 	opts.flags = GIT_DIFF_SHOW_BINARY | GIT_DIFF_FORCE_BINARY;
-	opts.id_abbrev = GIT_OID_HEXSZ;
+	opts.id_abbrev = GIT_OID_SHA1_HEXSIZE;
 
 	repo = cl_git_sandbox_init("renames");
 	cl_git_pass(git_repository_index(&index, repo));
@@ -389,7 +389,7 @@ void test_diff_binary__print_patch_from_diff(void)
 		"\n";
 
 	opts.flags = GIT_DIFF_SHOW_BINARY | GIT_DIFF_FORCE_BINARY;
-	opts.id_abbrev = GIT_OID_HEXSZ;
+	opts.id_abbrev = GIT_OID_SHA1_HEXSIZE;
 
 	repo = cl_git_sandbox_init("renames");
 	cl_git_pass(git_repository_index(&index, repo));
@@ -501,7 +501,7 @@ void test_diff_binary__blob_to_blob(void)
 	struct diff_data diff_data = {0};
 
 	opts.flags = GIT_DIFF_SHOW_BINARY | GIT_DIFF_FORCE_BINARY;
-	opts.id_abbrev = GIT_OID_HEXSZ;
+	opts.id_abbrev = GIT_OID_SHA1_HEXSIZE;
 
 	repo = cl_git_sandbox_init("renames");
 	cl_git_pass(git_repository_index__weakptr(&index, repo));
diff --git a/tests/libgit2/diff/parse.c b/tests/libgit2/diff/parse.c
index 9c3f798..cae843c 100644
--- a/tests/libgit2/diff/parse.c
+++ b/tests/libgit2/diff/parse.c
@@ -151,7 +151,7 @@ static void test_tree_to_tree_computed_to_parsed(
 
 	repo = cl_git_sandbox_init(sandbox);
 
-	opts.id_abbrev = GIT_OID_HEXSZ;
+	opts.id_abbrev = GIT_OID_SHA1_HEXSIZE;
 	opts.flags = GIT_DIFF_SHOW_BINARY | diff_flags;
 	findopts.flags = find_flags;
 
diff --git a/tests/libgit2/graph/commitgraph.c b/tests/libgit2/graph/commitgraph.c
index 7607c35..850f194 100644
--- a/tests/libgit2/graph/commitgraph.c
+++ b/tests/libgit2/graph/commitgraph.c
@@ -20,7 +20,7 @@ void test_graph_commitgraph__parse(void)
 	cl_assert_equal_i(git_commit_graph_file_needs_refresh(file, git_str_cstr(&commit_graph_path)), 0);
 
 	cl_git_pass(git_oid_fromstr(&id, "5001298e0c09ad9c34e4249bc5801c75e9754fa5"));
-	cl_git_pass(git_commit_graph_entry_find(&e, file, &id, GIT_OID_HEXSZ));
+	cl_git_pass(git_commit_graph_entry_find(&e, file, &id, GIT_OID_SHA1_HEXSIZE));
 	cl_assert_equal_oid(&e.sha1, &id);
 	cl_git_pass(git_oid_fromstr(&id, "418382dff1ffb8bdfba833f4d8bbcde58b1e7f47"));
 	cl_assert_equal_oid(&e.tree_oid, &id);
@@ -29,7 +29,7 @@ void test_graph_commitgraph__parse(void)
 	cl_assert_equal_i(e.parent_count, 0);
 
 	cl_git_pass(git_oid_fromstr(&id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644"));
-	cl_git_pass(git_commit_graph_entry_find(&e, file, &id, GIT_OID_HEXSZ));
+	cl_git_pass(git_commit_graph_entry_find(&e, file, &id, GIT_OID_SHA1_HEXSIZE));
 	cl_assert_equal_oid(&e.sha1, &id);
 	cl_assert_equal_i(e.generation, 5);
 	cl_assert_equal_i(e.commit_time, UINT64_C(1274813907));
@@ -63,7 +63,7 @@ void test_graph_commitgraph__parse_octopus_merge(void)
 	cl_git_pass(git_commit_graph_file_open(&file, git_str_cstr(&commit_graph_path)));
 
 	cl_git_pass(git_oid_fromstr(&id, "d71c24b3b113fd1d1909998c5bfe33b86a65ee03"));
-	cl_git_pass(git_commit_graph_entry_find(&e, file, &id, GIT_OID_HEXSZ));
+	cl_git_pass(git_commit_graph_entry_find(&e, file, &id, GIT_OID_SHA1_HEXSIZE));
 	cl_assert_equal_oid(&e.sha1, &id);
 	cl_git_pass(git_oid_fromstr(&id, "348f16ffaeb73f319a75cec5b16a0a47d2d5e27c"));
 	cl_assert_equal_oid(&e.tree_oid, &id);
diff --git a/tests/libgit2/merge/merge_helpers.h b/tests/libgit2/merge/merge_helpers.h
index 339812b..72c6e61 100644
--- a/tests/libgit2/merge/merge_helpers.h
+++ b/tests/libgit2/merge/merge_helpers.h
@@ -6,7 +6,7 @@
 
 struct merge_index_entry {
 	uint16_t mode;
-	char oid_str[GIT_OID_HEXSZ+1];
+	char oid_str[GIT_OID_SHA1_HEXSIZE+1];
 	int stage;
 	char path[128];
 };
@@ -27,9 +27,9 @@ struct merge_reuc_entry {
 	unsigned int ancestor_mode;
 	unsigned int our_mode;
 	unsigned int their_mode;
-	char ancestor_oid_str[GIT_OID_HEXSZ+1];
-	char our_oid_str[GIT_OID_HEXSZ+1];
-	char their_oid_str[GIT_OID_HEXSZ+1];
+	char ancestor_oid_str[GIT_OID_SHA1_HEXSIZE+1];
+	char our_oid_str[GIT_OID_SHA1_HEXSIZE+1];
+	char their_oid_str[GIT_OID_SHA1_HEXSIZE+1];
 };
 
 struct merge_index_conflict_data {
diff --git a/tests/libgit2/network/remote/rename.c b/tests/libgit2/network/remote/rename.c
index 1fd2aff..d4446b8 100644
--- a/tests/libgit2/network/remote/rename.c
+++ b/tests/libgit2/network/remote/rename.c
@@ -164,7 +164,7 @@ void test_network_remote_rename__renaming_a_remote_moves_the_underlying_referenc
 void test_network_remote_rename__overwrite_ref_in_target(void)
 {
 	git_oid id;
-	char idstr[GIT_OID_HEXSZ + 1] = {0};
+	char idstr[GIT_OID_SHA1_HEXSIZE + 1] = {0};
 	git_reference *ref;
 	git_branch_t btype;
 	git_branch_iterator *iter;
@@ -206,7 +206,7 @@ void test_network_remote_rename__symref_head(void)
 	git_branch_t btype;
 	git_branch_iterator *iter;
 	git_strarray problems = {0};
-	char idstr[GIT_OID_HEXSZ + 1] = {0};
+	char idstr[GIT_OID_SHA1_HEXSIZE + 1] = {0};
 	git_vector refs;
 
 	cl_git_pass(git_reference_symbolic_create(&ref, _repo, "refs/remotes/test/HEAD", "refs/remotes/test/master", 0, NULL));
diff --git a/tests/libgit2/object/raw/compare.c b/tests/libgit2/object/raw/compare.c
index 56c016b..9369bc2 100644
--- a/tests/libgit2/object/raw/compare.c
+++ b/tests/libgit2/object/raw/compare.c
@@ -76,17 +76,17 @@ void test_object_raw_compare__compare_fmt_oids(void)
 {
 	const char *exp = "16a0123456789abcdef4b775213c23a8bd74f5e0";
 	git_oid in;
-	char out[GIT_OID_HEXSZ + 1];
+	char out[GIT_OID_SHA1_HEXSIZE + 1];
 
 	cl_git_pass(git_oid_fromstr(&in, exp));
 
 	/* Format doesn't touch the last byte */
-	out[GIT_OID_HEXSZ] = 'Z';
+	out[GIT_OID_SHA1_HEXSIZE] = 'Z';
 	git_oid_fmt(out, &in);
-	cl_assert(out[GIT_OID_HEXSZ] == 'Z');
+	cl_assert(out[GIT_OID_SHA1_HEXSIZE] == 'Z');
 
 	/* Format produced the right result */
-	out[GIT_OID_HEXSZ] = '\0';
+	out[GIT_OID_SHA1_HEXSIZE] = '\0';
 	cl_assert_equal_s(exp, out);
 }
 
@@ -108,16 +108,16 @@ void test_object_raw_compare__compare_pathfmt_oids(void)
 	const char *exp1 = "16a0123456789abcdef4b775213c23a8bd74f5e0";
 	const char *exp2 = "16/a0123456789abcdef4b775213c23a8bd74f5e0";
 	git_oid in;
-	char out[GIT_OID_HEXSZ + 2];
+	char out[GIT_OID_SHA1_HEXSIZE + 2];
 
 	cl_git_pass(git_oid_fromstr(&in, exp1));
 
 	/* Format doesn't touch the last byte */
-	out[GIT_OID_HEXSZ + 1] = 'Z';
+	out[GIT_OID_SHA1_HEXSIZE + 1] = 'Z';
 	git_oid_pathfmt(out, &in);
-	cl_assert(out[GIT_OID_HEXSZ + 1] == 'Z');
+	cl_assert(out[GIT_OID_SHA1_HEXSIZE + 1] == 'Z');
 
 	/* Format produced the right result */
-	out[GIT_OID_HEXSZ + 1] = '\0';
+	out[GIT_OID_SHA1_HEXSIZE + 1] = '\0';
 	cl_assert_equal_s(exp2, out);
 }
diff --git a/tests/libgit2/object/raw/convert.c b/tests/libgit2/object/raw/convert.c
index 40a01ae..ebf2bb8 100644
--- a/tests/libgit2/object/raw/convert.c
+++ b/tests/libgit2/object/raw/convert.c
@@ -7,7 +7,7 @@ void test_object_raw_convert__succeed_on_oid_to_string_conversion(void)
 {
 	const char *exp = "16a0123456789abcdef4b775213c23a8bd74f5e0";
 	git_oid in;
-	char out[GIT_OID_HEXSZ + 1];
+	char out[GIT_OID_SHA1_HEXSIZE + 1];
 	char *str;
 	int i;
 
@@ -29,7 +29,7 @@ void test_object_raw_convert__succeed_on_oid_to_string_conversion(void)
 	str = git_oid_tostr(out, 1, &in);
 	cl_assert(str && *str == '\0' && str == out);
 
-	for (i = 1; i < GIT_OID_HEXSZ; i++) {
+	for (i = 1; i < GIT_OID_SHA1_HEXSIZE; i++) {
 		out[i+1] = 'Z';
 		str = git_oid_tostr(out, i+1, &in);
 		/* returns out containing c-string */
@@ -44,7 +44,7 @@ void test_object_raw_convert__succeed_on_oid_to_string_conversion(void)
 
 	/* returns out as hex formatted c-string */
 	str = git_oid_tostr(out, sizeof(out), &in);
-	cl_assert(str && str == out && *(str+GIT_OID_HEXSZ) == '\0');
+	cl_assert(str && str == out && *(str+GIT_OID_SHA1_HEXSIZE) == '\0');
 	cl_assert_equal_s(exp, out);
 }
 
@@ -52,26 +52,26 @@ void test_object_raw_convert__succeed_on_oid_to_string_conversion_big(void)
 {
 	const char *exp = "16a0123456789abcdef4b775213c23a8bd74f5e0";
 	git_oid in;
-	char big[GIT_OID_HEXSZ + 1 + 3]; /* note + 4 => big buffer */
+	char big[GIT_OID_SHA1_HEXSIZE + 1 + 3]; /* note + 4 => big buffer */
 	char *str;
 
 	cl_git_pass(git_oid_fromstr(&in, exp));
 
 	/* place some tail material */
-	big[GIT_OID_HEXSZ+0] = 'W'; /* should be '\0' afterwards */
-	big[GIT_OID_HEXSZ+1] = 'X'; /* should remain untouched   */
-	big[GIT_OID_HEXSZ+2] = 'Y'; /* ditto */
-	big[GIT_OID_HEXSZ+3] = 'Z'; /* ditto */
+	big[GIT_OID_SHA1_HEXSIZE+0] = 'W'; /* should be '\0' afterwards */
+	big[GIT_OID_SHA1_HEXSIZE+1] = 'X'; /* should remain untouched   */
+	big[GIT_OID_SHA1_HEXSIZE+2] = 'Y'; /* ditto */
+	big[GIT_OID_SHA1_HEXSIZE+3] = 'Z'; /* ditto */
 
 	/* returns big as hex formatted c-string */
 	str = git_oid_tostr(big, sizeof(big), &in);
-	cl_assert(str && str == big && *(str+GIT_OID_HEXSZ) == '\0');
+	cl_assert(str && str == big && *(str+GIT_OID_SHA1_HEXSIZE) == '\0');
 	cl_assert_equal_s(exp, big);
 
 	/* check tail material is untouched */
-	cl_assert(str && str == big && *(str+GIT_OID_HEXSZ+1) == 'X');
-	cl_assert(str && str == big && *(str+GIT_OID_HEXSZ+2) == 'Y');
-	cl_assert(str && str == big && *(str+GIT_OID_HEXSZ+3) == 'Z');
+	cl_assert(str && str == big && *(str+GIT_OID_SHA1_HEXSIZE+1) == 'X');
+	cl_assert(str && str == big && *(str+GIT_OID_SHA1_HEXSIZE+2) == 'Y');
+	cl_assert(str && str == big && *(str+GIT_OID_SHA1_HEXSIZE+3) == 'Z');
 }
 
 static void check_partial_oid(
@@ -86,14 +86,14 @@ void test_object_raw_convert__convert_oid_partially(void)
 {
 	const char *exp = "16a0123456789abcdef4b775213c23a8bd74f5e0";
 	git_oid in;
-	char big[GIT_OID_HEXSZ + 1 + 3]; /* note + 4 => big buffer */
+	char big[GIT_OID_SHA1_HEXSIZE + 1 + 3]; /* note + 4 => big buffer */
 
 	cl_git_pass(git_oid_fromstr(&in, exp));
 
 	git_oid_nfmt(big, sizeof(big), &in);
 	cl_assert_equal_s(exp, big);
 
-	git_oid_nfmt(big, GIT_OID_HEXSZ + 1, &in);
+	git_oid_nfmt(big, GIT_OID_SHA1_HEXSIZE + 1, &in);
 	cl_assert_equal_s(exp, big);
 
 	check_partial_oid(big, 1, &in, "1");
@@ -102,11 +102,11 @@ void test_object_raw_convert__convert_oid_partially(void)
 	check_partial_oid(big, 4, &in, "16a0");
 	check_partial_oid(big, 5, &in, "16a01");
 
-	check_partial_oid(big, GIT_OID_HEXSZ, &in, exp);
+	check_partial_oid(big, GIT_OID_SHA1_HEXSIZE, &in, exp);
 	check_partial_oid(
-		big, GIT_OID_HEXSZ - 1, &in, "16a0123456789abcdef4b775213c23a8bd74f5e");
+		big, GIT_OID_SHA1_HEXSIZE - 1, &in, "16a0123456789abcdef4b775213c23a8bd74f5e");
 	check_partial_oid(
-		big, GIT_OID_HEXSZ - 2, &in, "16a0123456789abcdef4b775213c23a8bd74f5");
+		big, GIT_OID_SHA1_HEXSIZE - 2, &in, "16a0123456789abcdef4b775213c23a8bd74f5");
 	check_partial_oid(
-		big, GIT_OID_HEXSZ - 3, &in, "16a0123456789abcdef4b775213c23a8bd74f");
+		big, GIT_OID_SHA1_HEXSIZE - 3, &in, "16a0123456789abcdef4b775213c23a8bd74f");
 }
diff --git a/tests/libgit2/object/raw/short.c b/tests/libgit2/object/raw/short.c
index cc2b5f6..1025268 100644
--- a/tests/libgit2/object/raw/short.c
+++ b/tests/libgit2/object/raw/short.c
@@ -17,7 +17,7 @@ void test_object_raw_short__oid_shortener_no_duplicates(void)
 	git_oid_shorten_add(os, "16a0123456789abcdef4b775213c23a8bd74f5e0");
 	min_len = git_oid_shorten_add(os, "ce08fe4884650f067bd5703b6a59a8b3b3c99a09");
 
-	cl_assert(min_len == GIT_OID_HEXSZ + 1);
+	cl_assert(min_len == GIT_OID_SHA1_HEXSIZE + 1);
 
 	git_oid_shorten_free(os);
 }
@@ -38,9 +38,9 @@ static int insert_sequential_oids(
 
 		git_oid_fromraw(&oid, hashbuf);
 
-		oids[i] = git__malloc(GIT_OID_HEXSZ + 1);
+		oids[i] = git__malloc(GIT_OID_SHA1_HEXSIZE + 1);
 		cl_assert(oids[i]);
-		git_oid_nfmt(oids[i], GIT_OID_HEXSZ + 1, &oid);
+		git_oid_nfmt(oids[i], GIT_OID_SHA1_HEXSIZE + 1, &oid);
 
 		min_len = git_oid_shorten_add(os, oids[i]);
 
diff --git a/tests/libgit2/object/raw/size.c b/tests/libgit2/object/raw/size.c
index 930c6de..ab6b1ff 100644
--- a/tests/libgit2/object/raw/size.c
+++ b/tests/libgit2/object/raw/size.c
@@ -6,8 +6,8 @@
 void test_object_raw_size__validate_oid_size(void)
 {
 	git_oid out;
-	cl_assert(20 == GIT_OID_RAWSZ);
-	cl_assert(40 == GIT_OID_HEXSZ);
-	cl_assert(sizeof(out) == GIT_OID_RAWSZ);
-	cl_assert(sizeof(out.id) == GIT_OID_RAWSZ);
+
+	cl_assert(20 == GIT_OID_SHA1_SIZE);
+	cl_assert(40 == GIT_OID_SHA1_HEXSIZE);
+	cl_assert(sizeof(out.id) == GIT_OID_SHA1_SIZE);
 }
diff --git a/tests/libgit2/odb/backend/backend_helpers.c b/tests/libgit2/odb/backend/backend_helpers.c
index 5427992..c595e47 100644
--- a/tests/libgit2/odb/backend/backend_helpers.c
+++ b/tests/libgit2/odb/backend/backend_helpers.c
@@ -34,7 +34,7 @@ static int fake_backend__exists(git_odb_backend *backend, const git_oid *oid)
 
 	fake->exists_calls++;
 
-	return search_object(NULL, fake, oid, GIT_OID_HEXSZ) == GIT_OK;
+	return search_object(NULL, fake, oid, GIT_OID_SHA1_HEXSIZE) == GIT_OK;
 }
 
 static int fake_backend__exists_prefix(
@@ -69,7 +69,7 @@ static int fake_backend__read(
 
 	fake->read_calls++;
 
-	if ((error = search_object(&obj, fake, oid, GIT_OID_HEXSZ)) < 0)
+	if ((error = search_object(&obj, fake, oid, GIT_OID_SHA1_HEXSIZE)) < 0)
 		return error;
 
 	*len_p = strlen(obj->content);
@@ -91,7 +91,7 @@ static int fake_backend__read_header(
 
 	fake->read_header_calls++;
 
-	if ((error = search_object(&obj, fake, oid, GIT_OID_HEXSZ)) < 0)
+	if ((error = search_object(&obj, fake, oid, GIT_OID_SHA1_HEXSIZE)) < 0)
 		return error;
 
 	*len_p = strlen(obj->content);
diff --git a/tests/libgit2/odb/mixed.c b/tests/libgit2/odb/mixed.c
index 87e945c..cbab8e3 100644
--- a/tests/libgit2/odb/mixed.c
+++ b/tests/libgit2/odb/mixed.c
@@ -21,10 +21,10 @@ void test_odb_mixed__dup_oid(void) {
 	git_odb_object *obj;
 
 	cl_git_pass(git_oid_fromstr(&oid, hex));
-	cl_git_pass(git_odb_read_prefix(&obj, _odb, &oid, GIT_OID_HEXSZ));
+	cl_git_pass(git_odb_read_prefix(&obj, _odb, &oid, GIT_OID_SHA1_HEXSIZE));
 	git_odb_object_free(obj);
 
-	cl_git_pass(git_odb_exists_prefix(NULL, _odb, &oid, GIT_OID_HEXSZ));
+	cl_git_pass(git_odb_exists_prefix(NULL, _odb, &oid, GIT_OID_SHA1_HEXSIZE));
 
 	cl_git_pass(git_oid_fromstrn(&oid, short_hex, sizeof(short_hex) - 1));
 	cl_git_pass(git_odb_read_prefix(&obj, _odb, &oid, sizeof(short_hex) - 1));
@@ -192,7 +192,7 @@ static void assert_found_objects(git_odb_expand_id *ids)
 
 		if (expand_id_test_data[i].expected_id) {
 			git_oid_fromstr(&expected_id, expand_id_test_data[i].expected_id);
-			expected_len = GIT_OID_HEXSZ;
+			expected_len = GIT_OID_SHA1_HEXSIZE;
 			expected_type = expand_id_test_data[i].expected_type;
 		}
 
diff --git a/tests/libgit2/pack/midx.c b/tests/libgit2/pack/midx.c
index 9dd9493..2a5c5a3 100644
--- a/tests/libgit2/pack/midx.c
+++ b/tests/libgit2/pack/midx.c
@@ -20,7 +20,7 @@ void test_pack_midx__parse(void)
 	cl_assert_equal_i(git_midx_needs_refresh(idx, git_str_cstr(&midx_path)), 0);
 
 	cl_git_pass(git_oid_fromstr(&id, "5001298e0c09ad9c34e4249bc5801c75e9754fa5"));
-	cl_git_pass(git_midx_entry_find(&e, idx, &id, GIT_OID_HEXSZ));
+	cl_git_pass(git_midx_entry_find(&e, idx, &id, GIT_OID_SHA1_HEXSIZE));
 	cl_assert_equal_oid(&e.sha1, &id);
 	cl_assert_equal_s(
 			(const char *)git_vector_get(&idx->packfile_names, e.pack_index),
@@ -40,7 +40,7 @@ void test_pack_midx__lookup(void)
 	cl_git_pass(git_repository_open(&repo, cl_fixture("testrepo.git")));
 
 	cl_git_pass(git_oid_fromstr(&id, "5001298e0c09ad9c34e4249bc5801c75e9754fa5"));
-	cl_git_pass(git_commit_lookup_prefix(&commit, repo, &id, GIT_OID_HEXSZ));
+	cl_git_pass(git_commit_lookup_prefix(&commit, repo, &id, GIT_OID_SHA1_HEXSIZE));
 	cl_assert_equal_s(git_commit_message(commit), "packed commit one\n");
 
 	git_commit_free(commit);
diff --git a/tests/libgit2/patch/parse.c b/tests/libgit2/patch/parse.c
index a3c4c67..d90576e 100644
--- a/tests/libgit2/patch/parse.c
+++ b/tests/libgit2/patch/parse.c
@@ -7,7 +7,7 @@
 static void ensure_patch_validity(git_patch *patch)
 {
 	const git_diff_delta *delta;
-	char idstr[GIT_OID_HEXSZ+1] = {0};
+	char idstr[GIT_OID_SHA1_HEXSIZE+1] = {0};
 
 	cl_assert((delta = git_patch_get_delta(patch)) != NULL);
 	cl_assert_equal_i(2, delta->nfiles);
diff --git a/tests/libgit2/refs/reflog/reflog_helpers.c b/tests/libgit2/refs/reflog/reflog_helpers.c
index 2ea41ee..f62d27e 100644
--- a/tests/libgit2/refs/reflog/reflog_helpers.c
+++ b/tests/libgit2/refs/reflog/reflog_helpers.c
@@ -6,12 +6,12 @@
 
 int reflog_entry_tostr(git_str *out, const git_reflog_entry *entry)
 {
-	char old_oid[GIT_OID_HEXSZ], new_oid[GIT_OID_HEXSZ];
+	char old_oid[GIT_OID_SHA1_HEXSIZE], new_oid[GIT_OID_SHA1_HEXSIZE];
 
 	assert(out && entry);
 
-	git_oid_tostr((char *)&old_oid, GIT_OID_HEXSZ, git_reflog_entry_id_old(entry));
-	git_oid_tostr((char *)&new_oid, GIT_OID_HEXSZ, git_reflog_entry_id_new(entry));
+	git_oid_tostr((char *)&old_oid, GIT_OID_SHA1_HEXSIZE, git_reflog_entry_id_old(entry));
+	git_oid_tostr((char *)&new_oid, GIT_OID_SHA1_HEXSIZE, git_reflog_entry_id_new(entry));
 
 	return git_str_printf(out, "%s %s %s %s", old_oid, new_oid, "somesig", git_reflog_entry_message(entry));
 }
diff --git a/tests/libgit2/refs/revparse.c b/tests/libgit2/refs/revparse.c
index 56af3c9..02ffe00 100644
--- a/tests/libgit2/refs/revparse.c
+++ b/tests/libgit2/refs/revparse.c
@@ -652,7 +652,7 @@ void test_refs_revparse__try_to_retrieve_branch_before_described_tag(void)
 	git_repository *repo;
 	git_reference *branch;
 	git_object *target;
-	char sha[GIT_OID_HEXSZ + 1];
+	char sha[GIT_OID_SHA1_HEXSIZE + 1];
 
 	repo = cl_git_sandbox_init("testrepo.git");
 
@@ -661,7 +661,7 @@ void test_refs_revparse__try_to_retrieve_branch_before_described_tag(void)
 	cl_git_pass(git_revparse_single(&target, repo, "HEAD~3"));
 	cl_git_pass(git_branch_create(&branch, repo, "blah-7-gc47800c", (git_commit *)target, 0));
 
-	git_oid_tostr(sha, GIT_OID_HEXSZ + 1, git_object_id(target));
+	git_oid_tostr(sha, GIT_OID_SHA1_HEXSIZE + 1, git_object_id(target));
 
 	test_object_inrepo("blah-7-gc47800c", sha, repo);
 
@@ -690,7 +690,7 @@ void test_refs_revparse__try_to_retrieve_sha_before_branch(void)
 	git_repository *repo;
 	git_reference *branch;
 	git_object *target;
-	char sha[GIT_OID_HEXSZ + 1];
+	char sha[GIT_OID_SHA1_HEXSIZE + 1];
 
 	repo = cl_git_sandbox_init("testrepo.git");
 
@@ -699,7 +699,7 @@ void test_refs_revparse__try_to_retrieve_sha_before_branch(void)
 	cl_git_pass(git_revparse_single(&target, repo, "HEAD~3"));
 	cl_git_pass(git_branch_create(&branch, repo, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", (git_commit *)target, 0));
 
-	git_oid_tostr(sha, GIT_OID_HEXSZ + 1, git_object_id(target));
+	git_oid_tostr(sha, GIT_OID_SHA1_HEXSIZE + 1, git_object_id(target));
 
 	test_object_inrepo("a65fedf39aefe402d3bb6e24df4d4f5fe4547750", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", repo);
 	test_object_inrepo("heads/a65fedf39aefe402d3bb6e24df4d4f5fe4547750", sha, repo);
@@ -726,7 +726,7 @@ void test_refs_revparse__try_to_retrieve_branch_before_abbrev_sha(void)
 	git_repository *repo;
 	git_reference *branch;
 	git_object *target;
-	char sha[GIT_OID_HEXSZ + 1];
+	char sha[GIT_OID_SHA1_HEXSIZE + 1];
 
 	repo = cl_git_sandbox_init("testrepo.git");
 
@@ -735,7 +735,7 @@ void test_refs_revparse__try_to_retrieve_branch_before_abbrev_sha(void)
 	cl_git_pass(git_revparse_single(&target, repo, "HEAD~3"));
 	cl_git_pass(git_branch_create(&branch, repo, "c47800", (git_commit *)target, 0));
 
-	git_oid_tostr(sha, GIT_OID_HEXSZ + 1, git_object_id(target));
+	git_oid_tostr(sha, GIT_OID_SHA1_HEXSIZE + 1, git_object_id(target));
 
 	test_object_inrepo("c47800", sha, repo);
 
diff --git a/tests/libgit2/repo/init.c b/tests/libgit2/repo/init.c
index 7cf6742..adcd9e0 100644
--- a/tests/libgit2/repo/init.c
+++ b/tests/libgit2/repo/init.c
@@ -708,7 +708,7 @@ void test_repo_init__defaultbranch_config_empty(void)
 void test_repo_init__longpath(void)
 {
 #ifdef GIT_WIN32
-	size_t padding = CONST_STRLEN("objects/pack/pack-.pack.lock") + GIT_OID_HEXSZ;
+	size_t padding = CONST_STRLEN("objects/pack/pack-.pack.lock") + GIT_OID_SHA1_HEXSIZE;
 	size_t max, i;
 	git_str path = GIT_STR_INIT;
 	git_repository *one = NULL, *two = NULL;
diff --git a/tests/libgit2/reset/soft.c b/tests/libgit2/reset/soft.c
index aca0834..1289050 100644
--- a/tests/libgit2/reset/soft.c
+++ b/tests/libgit2/reset/soft.c
@@ -53,11 +53,11 @@ void test_reset_soft__can_reset_the_detached_Head_to_the_specified_commit(void)
 void test_reset_soft__resetting_to_the_commit_pointed_at_by_the_Head_does_not_change_the_target_of_the_Head(void)
 {
 	git_oid oid;
-	char raw_head_oid[GIT_OID_HEXSZ + 1];
+	char raw_head_oid[GIT_OID_SHA1_HEXSIZE + 1];
 
 	cl_git_pass(git_reference_name_to_id(&oid, repo, "HEAD"));
 	git_oid_fmt(raw_head_oid, &oid);
-	raw_head_oid[GIT_OID_HEXSZ] = '\0';
+	raw_head_oid[GIT_OID_SHA1_HEXSIZE] = '\0';
 
 	cl_git_pass(git_revparse_single(&target, repo, raw_head_oid));
 
diff --git a/tests/libgit2/revwalk/basic.c b/tests/libgit2/revwalk/basic.c
index 2c8d885..358f577 100644
--- a/tests/libgit2/revwalk/basic.c
+++ b/tests/libgit2/revwalk/basic.c
@@ -50,12 +50,12 @@ static const int result_bytes = 24;
 static int get_commit_index(git_oid *raw_oid)
 {
 	int i;
-	char oid[GIT_OID_HEXSZ];
+	char oid[GIT_OID_SHA1_HEXSIZE];
 
 	git_oid_fmt(oid, raw_oid);
 
 	for (i = 0; i < commit_count; ++i)
-		if (memcmp(oid, commit_ids[i], GIT_OID_HEXSZ) == 0)
+		if (memcmp(oid, commit_ids[i], GIT_OID_SHA1_HEXSIZE) == 0)
 			return i;
 
 	return -1;
@@ -75,9 +75,9 @@ static int test_walk_only(git_revwalk *walk,
 	while (git_revwalk_next(&oid, walk) == 0) {
 		result_array[i++] = get_commit_index(&oid);
 		/*{
-			char str[GIT_OID_HEXSZ+1];
+			char str[GIT_OID_SHA1_HEXSIZE+1];
 			git_oid_fmt(str, &oid);
-			str[GIT_OID_HEXSZ] = 0;
+			str[GIT_OID_SHA1_HEXSIZE] = 0;
 			printf("  %d) %s\n", i, str);
 		}*/
 	}