Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Implements cherokee_buffer_encode_sha512_base64()

git-svn-id: svn://cherokee-project.com/cherokee/trunk@6764 5dc97367-97f1-0310-9951-d761b3857238
  • Loading branch information...
commit b244a9815732a51e3bbf871c234398c48119f263 1 parent 0d5241b
Alvaro Lopez Ortega alobbs authored
Showing with 23 additions and 0 deletions.
  1. +22 −0 cherokee/buffer.c
  2. +1 −0  cherokee/buffer.h
22 cherokee/buffer.c
View
@@ -1897,6 +1897,28 @@ cherokee_buffer_encode_sha512_digest (cherokee_buffer_t *buf)
}
+ret_t
+cherokee_buffer_encode_sha512_base64 (cherokee_buffer_t *buf, cherokee_buffer_t *encoded)
+{
+ /* Prepare destination buffer
+ */
+ cherokee_buffer_ensure_size (encoded, (SHA512_DIGEST_LENGTH * 2) + 1);
+ cherokee_buffer_clean (encoded);
+
+ /* Encode sha1 + base64
+ */
+ cherokee_buffer_encode_sha512 (buf, encoded);
+ cherokee_buffer_encode_base64 (encoded, buf);
+
+ /* Copy result to destination buffer
+ */
+ cherokee_buffer_clean (encoded);
+ cherokee_buffer_add_buffer (encoded, buf);
+
+ return ret_ok;
+}
+
+
/* Encode in hexadecimal characters, source buffer (buf) is not touched,
* whereas destination buffer (encoded) is overwritten
* but possibly not reallocated.
1  cherokee/buffer.h
View
@@ -124,6 +124,7 @@ ret_t cherokee_buffer_encode_sha1_digest (cherokee_buffer_t *buf);
ret_t cherokee_buffer_encode_sha1_base64 (cherokee_buffer_t *buf, cherokee_buffer_t *encoded);
ret_t cherokee_buffer_encode_sha512 (cherokee_buffer_t *buf, cherokee_buffer_t *encoded);
ret_t cherokee_buffer_encode_sha512_digest (cherokee_buffer_t *buf);
+ret_t cherokee_buffer_encode_sha512_base64 (cherokee_buffer_t *buf, cherokee_buffer_t *encoded);
ret_t cherokee_buffer_encode_hex (cherokee_buffer_t *buf, cherokee_buffer_t *encoded);
ret_t cherokee_buffer_decode_hex (cherokee_buffer_t *buf);
ret_t cherokee_buffer_unescape_uri (cherokee_buffer_t *buf);
Please sign in to comment.
Something went wrong with that request. Please try again.