MCPcopy Create free account
hub / github.com/apache/trafficserver / CryptoContext

Class CryptoContext

include/tscore/CryptoHash.h:127–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125};
126
127class CryptoContext
128{
129public:
130 /** Protocol class for a crypto hash context.
131
132 A hash of this type is used for strong hashing, such as for URLs.
133 */
134 class Hasher
135 {
136 using self_type = Hasher; ///< Self reference type.
137 public:
138 /// Destructor (force virtual)
139 virtual ~Hasher() {}
140 /// Update the hash with @a data of @a length bytes.
141 virtual bool update(void const *data, int length) = 0;
142 /// Finalize and extract the @a hash.
143 virtual bool finalize(CryptoHash &hash) = 0;
144
145 /// Convenience overload.
146 bool finalize(CryptoHash *hash);
147
148 protected:
149 EVP_MD_CTX *_ctx = nullptr;
150 };
151
152 CryptoContext();
153
154 /// Update the hash with @a data of @a length bytes.
155 bool update(void const *data, int length);
156
157 /// Convenience - compute final @a hash for @a data.
158 /// @note This is just as fast as the previous style, as a new context must be initialized
159 /// every time this is done.
160 bool hash_immediate(CryptoHash &hash, void const *data, int length);
161
162 /// Finalize and extract the @a hash.
163 bool finalize(CryptoHash &hash);
164
165 enum HashType {
166 UNSPECIFIED,
167#if TS_ENABLE_FIPS == 0
168 MD5,
169#endif
170 SHA256,
171 }; ///< What type of hash we really are.
172 static HashType Setting;
173
174 ~CryptoContext();
175
176private:
177 static size_t constexpr OBJ_SIZE = 256;
178 char _base[OBJ_SIZE];
179};
180
181inline bool
182CryptoContext::Hasher::finalize(CryptoHash *hash)

Callers 11

initMethod · 0.85
obtain_outboundMethod · 0.85
acquire_sessionMethod · 0.85
id_from_nameMethod · 0.85
compute_signatureMethod · 0.85
ats_ip_hashFunction · 0.85
TSCacheKeyDigestSetFunction · 0.85
StripeSMMethod · 0.85
tsmemcache.ccFile · 0.85
attach_hostnameMethod · 0.85

Calls

no outgoing calls