File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
crates/jrsonnet-stdlib/src Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -5,9 +5,14 @@ pub fn builtin_md5(s: IStr) -> String {
5
5
format ! ( "{:x}" , md5:: compute( s. as_bytes( ) ) )
6
6
}
7
7
8
- #[ cfg( feature = "exp-more-hashes" ) ]
9
8
#[ builtin]
10
9
pub fn builtin_sha256 ( s : IStr ) -> String {
11
10
use sha2:: digest:: Digest ;
12
- format ! ( "{:?}" , sha2:: Sha256 :: digest( s. as_bytes( ) ) )
11
+ format ! ( "{:x}" , sha2:: Sha256 :: digest( s. as_bytes( ) ) )
12
+ }
13
+
14
+ #[ builtin]
15
+ pub fn builtin_sha512 ( s : IStr ) -> String {
16
+ use sha2:: digest:: Digest ;
17
+ format ! ( "{:x}" , sha2:: Sha512 :: digest( s. as_bytes( ) ) )
13
18
}
Original file line number Diff line number Diff line change @@ -115,6 +115,7 @@ pub fn stdlib_uncached(settings: Rc<RefCell<Settings>>) -> ObjValue {
115
115
// Hash
116
116
( "md5" , builtin_md5:: INST ) ,
117
117
( "sha256" , builtin_sha256:: INST ) ,
118
+ ( "sha512" , builtin_sha512:: INST ) ,
118
119
// Encoding
119
120
( "encodeUTF8" , builtin_encode_utf8:: INST ) ,
120
121
( "decodeUTF8" , builtin_decode_utf8:: INST ) ,
You can’t perform that action at this time.
0 commit comments