MCPcopy Create free account
hub / github.com/OpenPrinting/cups / cupsHashString

Function cupsHashString

cups/hash.c:79–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77//
78
79const char * // O - Formatted string
80cupsHashString(
81 const unsigned char *hash, // I - Hash
82 size_t hashsize, // I - Size of hash
83 char *buffer, // I - String buffer
84 size_t bufsize) // I - Size of string buffer
85{
86 char *bufptr = buffer; // Pointer into buffer
87 static const char *hex = "0123456789abcdef";
88 // Hex characters (lowercase!)
89
90
91 // Range check input...
92 if (!hash || hashsize < 1 || !buffer || bufsize < (2 * hashsize + 1))
93 {
94 if (buffer)
95 *buffer = '\0';
96 return (NULL);
97 }
98
99 // Loop until we've converted the whole hash...
100 while (hashsize > 0)
101 {
102 *bufptr++ = hex[*hash >> 4];
103 *bufptr++ = hex[*hash & 15];
104
105 hash ++;
106 hashsize --;
107 }
108
109 *bufptr = '\0';
110
111 return (buffer);
112}
113
114
115//

Callers 2

cgi_set_sidFunction · 0.85
_httpSetDigestAuthStringFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected