InChI
 
Loading...
Searching...
No Matches
ikey_base26.h
Go to the documentation of this file.
1/*
2 * SPDX-License-Identifier: MIT
3 * Copyright (c) 2024 IUPAC and InChI Trust
4 */
5
6
7#ifndef _IKEY_BASE26_H_
8#define _IKEY_BASE26_H_
9
10/*
11 Base-26 encoding procedures.
12
13 'Base26' characters here are considered to be uppercase English
14 letters 'A..Z'
15*/
16
17
18/* Uncomment the next line to fix base-26 encoding bug */
19/*#define FIX_BASE26_ENC_BUG 1*/
20
21typedef unsigned int UINT32;
22typedef unsigned short int UINT16;
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28/* Get a character representing 1st 14-bit triplet
29 (bits 0..13 of contiguous array of octets) */
30 const char* base26_triplet_1( const unsigned char *a );
31 /* Get a character representing 2nd 14-bit triplet (bits 14..27) */
32 const char* base26_triplet_2( const unsigned char *a );
33 /* Get a character representing 3rd 14-bit triplet (bits 28..41) */
34 const char* base26_triplet_3( const unsigned char *a );
35 /* Get a character representing 4th 14-bit triplet (bits 42..55) */
36 const char* base26_triplet_4( const unsigned char *a );
37
38 /*
39 Tail dublets
40 */
41
42 /* Get dublet (bits 28..36) */
43 const char* base26_dublet_for_bits_28_to_36( unsigned char *a );
44 /* Get dublet (bits 56..64) */
45 const char* base26_dublet_for_bits_56_to_64( unsigned char *a );
46 /* Get hash extension in hexadecimal representation for the major block.
47 Len(extension) = 256 - 65 = 191 bit. */
48 void get_xtra_hash_major_hex( const unsigned char *a, char* szXtra );
49 /* Get hash extension in hexadecimal representation for the minor block.
50 Len(extension) = 256 - 37 = 219 bit. */
51 void get_xtra_hash_minor_hex( const unsigned char *a, char* szXtra );
52
53 /* Used instead of isupper() to avoid locale interference. */
54#define isbase26(_c) ( ((unsigned)(_c) >= 'A') && ((unsigned)(_c) <= 'Z') )
55
56#ifdef __cplusplus
57}
58#endif
59
60
61#endif /* _IKEY_BASE26_H_ */
const char * base26_triplet_2(const unsigned char *a)
Definition ikey_base26.c:1156
const char * base26_triplet_3(const unsigned char *a)
Definition ikey_base26.c:1177
void get_xtra_hash_minor_hex(const unsigned char *a, char *szXtra)
Definition ikey_base26.c:1293
const char * base26_dublet_for_bits_56_to_64(unsigned char *a)
Definition ikey_base26.c:1252
void get_xtra_hash_major_hex(const unsigned char *a, char *szXtra)
Definition ikey_base26.c:1272
const char * base26_triplet_1(const unsigned char *a)
Definition ikey_base26.c:1138
unsigned short int UINT16
Definition ikey_base26.h:22
const char * base26_triplet_4(const unsigned char *a)
Definition ikey_base26.c:1198
const char * base26_dublet_for_bits_28_to_36(unsigned char *a)
Definition ikey_base26.c:1227
unsigned int UINT32
Definition ikey_base26.h:21