Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[enhance] Crypto: make Cryptokit Base64 functions available in Opa

  • Loading branch information...
commit fb992feefed07588ca277279a2058223388aaab8 1 parent d3454c5
@Aqua-Ye Aqua-Ye authored
Showing with 19 additions and 3 deletions.
  1. +13 −3 plugins/crypto/bslCrypto.ml
  2. +6 −0 stdlib/crypto/crypto.opa
View
16 plugins/crypto/bslCrypto.ml
@@ -1,5 +1,5 @@
(*
- Copyright © 2011 MLstate
+ Copyright © 2011, 2012 MLstate
This file is part of OPA.
@@ -21,12 +21,22 @@ let md5 = (fun x -> Digest.to_hex (Digest.string x))
##register base64_encode : string -> string
let base64_encode str =
BaseString.base64encode str
- (* Cryptokit.transform_string (Cryptokit.Base64.encode_compact ()) str *)
+
+##register base64_encode_compact : string -> string
+let base64_encode_compact str =
+ Cryptokit.transform_string (Cryptokit.Base64.encode_compact ()) str
+
+##register base64_encode_multiline : string -> string
+let base64_encode_multiline str =
+ Cryptokit.transform_string (Cryptokit.Base64.encode_multiline ()) str
##register base64_decode : string -> string
let base64_decode str =
BaseString.base64decode str
- (* Cryptokit.transform_string (Cryptokit.Base64.decode ()) str *)
+
+##register base64_decode2 : string -> string
+let base64_decode2 str =
+ Cryptokit.transform_string (Cryptokit.Base64.decode ()) str
##register hmac_sha1 : string, string -> string
let hmac_sha1 key text =
View
6 stdlib/crypto/crypto.opa
@@ -42,8 +42,14 @@ Crypto = {{
encode = %% BslCrypto.base64_encode %% : string -> string
+ encode_compact = %% BslCrypto.base64_encode_compact %% : string -> string
+
+ encode_multiline = %% BslCrypto.base64_encode_multiline %% : string -> string
+
decode = %% BslCrypto.base64_decode %% : string -> string
+ decode2 = %% BslCrypto.base64_decode2 %% : string -> string
+
}}
Hash = {{
Please sign in to comment.
Something went wrong with that request. Please try again.