summaryrefslogtreecommitdiff
path: root/src/common/crypto.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2005-09-18 02:18:59 +0000
committerNick Mathewson <nickm@torproject.org>2005-09-18 02:18:59 +0000
commitf8a80e8d599d87ea18cb72b7b22441612f1e26ac (patch)
tree08d3f997bbc3bd22143dcedcd74a958eb14e2766 /src/common/crypto.h
parent312af361269a1b82e3e1b2df3a961eba8748f0ad (diff)
downloadtor-f8a80e8d599d87ea18cb72b7b22441612f1e26ac.tar.gz
tor-f8a80e8d599d87ea18cb72b7b22441612f1e26ac.zip
Helper functions to perform our truncated base64 encoding on hexdigests.
svn:r5087
Diffstat (limited to 'src/common/crypto.h')
-rw-r--r--src/common/crypto.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/common/crypto.h b/src/common/crypto.h
index 903fe72ea0..ce01fee103 100644
--- a/src/common/crypto.h
+++ b/src/common/crypto.h
@@ -24,6 +24,9 @@
/** Length of our DH keys. */
#define DH_BYTES (1024/8)
+/* DOCDOC */
+#define BASE64_DIGEST_LEN 27
+
/** Constants used to indicate no padding for public-key encryption */
#define PK_NO_PADDING 60000
/** Constants used to indicate PKCS1 padding for public-key encryption */
@@ -155,6 +158,9 @@ int base64_decode(char *dest, size_t destlen, const char *src, size_t srclen);
#define BASE32_CHARS "abcdefghijklmnopqrstuvwxyz234567"
void base32_encode(char *dest, size_t destlen, const char *src, size_t srclen);
+int digest_to_base64(char *d64, const char *digest);
+int digest_from_base64(char *digest, const char *d64);
+
#define S2K_SPECIFIER_LEN 9
void secret_to_key(char *key_out, size_t key_out_len, const char *secret,
size_t secret_len, const char *s2k_specifier);