Skip to content

Commit

Permalink
[enhance] Crypto: make Cryptokit Base64 functions available in Opa
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederic Ye committed Jan 24, 2012
1 parent d3454c5 commit fb992fe
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
16 changes: 13 additions & 3 deletions plugins/crypto/bslCrypto.ml
@@ -1,5 +1,5 @@
(* (*
Copyright © 2011 MLstate Copyright © 2011, 2012 MLstate
This file is part of OPA. This file is part of OPA.
Expand All @@ -21,12 +21,22 @@ let md5 = (fun x -> Digest.to_hex (Digest.string x))
##register base64_encode : string -> string ##register base64_encode : string -> string
let base64_encode str = let base64_encode str =
BaseString.base64encode 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 ##register base64_decode : string -> string
let base64_decode str = let base64_decode str =
BaseString.base64decode 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 ##register hmac_sha1 : string, string -> string
let hmac_sha1 key text = let hmac_sha1 key text =
Expand Down
6 changes: 6 additions & 0 deletions stdlib/crypto/crypto.opa
Expand Up @@ -42,8 +42,14 @@ Crypto = {{


encode = %% BslCrypto.base64_encode %% : string -> string 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 decode = %% BslCrypto.base64_decode %% : string -> string


decode2 = %% BslCrypto.base64_decode2 %% : string -> string

}} }}


Hash = {{ Hash = {{
Expand Down

0 comments on commit fb992fe

Please sign in to comment.