aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Phillips <david@sighup.nz>2017-07-03 17:50:03 +1200
committerDavid Phillips <david@sighup.nz>2017-07-03 17:50:03 +1200
commit92d9e59d6b3dc5375c100c72ba8907502aea8331 (patch)
tree976216848cf23f3536e6c9e3ac5c9d4e4b152932
parentfb57a61ce55f6dc2a08c0442466d765dcf1782a2 (diff)
downloadsand-leek-92d9e59d6b3dc5375c100c72ba8907502aea8331.tar.xz
Add more function docs to onion_base32.c
-rw-r--r--onion_base32.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/onion_base32.c b/onion_base32.c
index 7863f8c..701b302 100644
--- a/onion_base32.c
+++ b/onion_base32.c
@@ -3,6 +3,11 @@
static const char base32_lookup[] = "abcdefghijklmnopqrstuvwxyz234567";
+/* Find the first instance of a character in `subject` which is not in the
+ * base32 alphabet.
+ * Returns the offset into `subject` of the first such character, or -1
+ * if no such character exists in the string
+ */
int
check_base32(char *subject) {
size_t offset = 0;
@@ -35,6 +40,9 @@ onion_base32(char output[16], unsigned char sum[20]) {
}
}
+/* Helper function for onion_base32_dec. Decodes a single base32 character
+ * into its binary equivalent
+ */
unsigned char
base32_dec_single(char b) {
if (b >= 'a' && b <= 'z')