• Home
  • Raw
  • Download

Lines Matching refs:MessageDigest

55 pub struct MessageDigest(*const ffi::EVP_MD);  struct
57 impl MessageDigest { implementation
64 MessageDigest(x) in from_ptr()
72 pub fn from_nid(type_: Nid) -> Option<MessageDigest> { in from_nid() argument
78 Some(MessageDigest(ptr)) in from_nid()
88 pub fn from_name(name: &str) -> Option<MessageDigest> { in from_name() argument
96 Some(MessageDigest(ptr)) in from_name()
102 pub fn null() -> MessageDigest { in null()
103 unsafe { MessageDigest(ffi::EVP_md_null()) } in null()
106 pub fn md5() -> MessageDigest { in md5()
107 unsafe { MessageDigest(ffi::EVP_md5()) } in md5()
110 pub fn sha1() -> MessageDigest { in sha1()
111 unsafe { MessageDigest(ffi::EVP_sha1()) } in sha1()
114 pub fn sha224() -> MessageDigest { in sha224()
115 unsafe { MessageDigest(ffi::EVP_sha224()) } in sha224()
118 pub fn sha256() -> MessageDigest { in sha256()
119 unsafe { MessageDigest(ffi::EVP_sha256()) } in sha256()
122 pub fn sha384() -> MessageDigest { in sha384()
123 unsafe { MessageDigest(ffi::EVP_sha384()) } in sha384()
126 pub fn sha512() -> MessageDigest { in sha512()
127 unsafe { MessageDigest(ffi::EVP_sha512()) } in sha512()
131 pub fn sha3_224() -> MessageDigest { in sha3_224()
132 unsafe { MessageDigest(ffi::EVP_sha3_224()) } in sha3_224()
136 pub fn sha3_256() -> MessageDigest { in sha3_256()
137 unsafe { MessageDigest(ffi::EVP_sha3_256()) } in sha3_256()
141 pub fn sha3_384() -> MessageDigest { in sha3_384()
142 unsafe { MessageDigest(ffi::EVP_sha3_384()) } in sha3_384()
146 pub fn sha3_512() -> MessageDigest { in sha3_512()
147 unsafe { MessageDigest(ffi::EVP_sha3_512()) } in sha3_512()
151 pub fn shake_128() -> MessageDigest { in shake_128()
152 unsafe { MessageDigest(ffi::EVP_shake128()) } in shake_128()
156 pub fn shake_256() -> MessageDigest { in shake_256()
157 unsafe { MessageDigest(ffi::EVP_shake256()) } in shake_256()
161 pub fn ripemd160() -> MessageDigest { in ripemd160()
162 unsafe { MessageDigest(ffi::EVP_ripemd160()) } in ripemd160()
166 pub fn sm3() -> MessageDigest { in sm3()
167 unsafe { MessageDigest(ffi::EVP_sm3()) } in sm3()
194 unsafe impl Sync for MessageDigest {} implementation
195 unsafe impl Send for MessageDigest {} implementation
237 type_: MessageDigest,
246 pub fn new(ty: MessageDigest) -> Result<Hasher, ErrorStack> { in new()
436 pub fn hash(t: MessageDigest, data: &[u8]) -> Result<DigestBytes, ErrorStack> { in hash() argument
457 pub fn hash_xof(t: MessageDigest, data: &[u8], buf: &mut [u8]) -> Result<(), ErrorStack> { in hash_xof() argument
470 fn hash_test(hashtype: MessageDigest, hashtest: &(&str, &str)) { in hash_test() argument
476 fn hash_xof_test(hashtype: MessageDigest, hashtest: &(&str, &str)) { in hash_xof_test() argument
517 hash_test(MessageDigest::md5(), test); in test_md5()
520 assert_eq!(MessageDigest::md5().block_size(), 64); in test_md5()
521 assert_eq!(MessageDigest::md5().size(), 16); in test_md5()
522 assert_eq!(MessageDigest::md5().type_().as_raw(), Nid::MD5.as_raw()); in test_md5()
527 let mut h = Hasher::new(MessageDigest::md5()).unwrap(); in test_md5_recycle()
535 let mut h = Hasher::new(MessageDigest::md5()).unwrap(); in test_finish_twice()
540 let null = hash(MessageDigest::md5(), &[]).unwrap(); in test_finish_twice()
551 let h0 = Hasher::new(MessageDigest::md5()).unwrap(); in test_clone()
580 hash_test(MessageDigest::sha1(), test); in test_sha1()
583 assert_eq!(MessageDigest::sha1().block_size(), 64); in test_sha1()
584 assert_eq!(MessageDigest::sha1().size(), 20); in test_sha1()
585 assert_eq!(MessageDigest::sha1().type_().as_raw(), Nid::SHA1.as_raw()); in test_sha1()
596 hash_test(MessageDigest::sha256(), test); in test_sha256()
599 assert_eq!(MessageDigest::sha256().block_size(), 64); in test_sha256()
600 assert_eq!(MessageDigest::sha256().size(), 32); in test_sha256()
602 MessageDigest::sha256().type_().as_raw(), in test_sha256()
616 hash_test(MessageDigest::sha512(), test); in test_sha512()
619 assert_eq!(MessageDigest::sha512().block_size(), 128); in test_sha512()
620 assert_eq!(MessageDigest::sha512().size(), 64); in test_sha512()
622 MessageDigest::sha512().type_().as_raw(), in test_sha512()
636 hash_test(MessageDigest::sha3_224(), test); in test_sha3_224()
639 assert_eq!(MessageDigest::sha3_224().block_size(), 144); in test_sha3_224()
640 assert_eq!(MessageDigest::sha3_224().size(), 28); in test_sha3_224()
642 MessageDigest::sha3_224().type_().as_raw(), in test_sha3_224()
656 hash_test(MessageDigest::sha3_256(), test); in test_sha3_256()
659 assert_eq!(MessageDigest::sha3_256().block_size(), 136); in test_sha3_256()
660 assert_eq!(MessageDigest::sha3_256().size(), 32); in test_sha3_256()
662 MessageDigest::sha3_256().type_().as_raw(), in test_sha3_256()
676 hash_test(MessageDigest::sha3_384(), test); in test_sha3_384()
679 assert_eq!(MessageDigest::sha3_384().block_size(), 104); in test_sha3_384()
680 assert_eq!(MessageDigest::sha3_384().size(), 48); in test_sha3_384()
682 MessageDigest::sha3_384().type_().as_raw(), in test_sha3_384()
696 hash_test(MessageDigest::sha3_512(), test); in test_sha3_512()
699 assert_eq!(MessageDigest::sha3_512().block_size(), 72); in test_sha3_512()
700 assert_eq!(MessageDigest::sha3_512().size(), 64); in test_sha3_512()
702 MessageDigest::sha3_512().type_().as_raw(), in test_sha3_512()
716 hash_xof_test(MessageDigest::shake_128(), test); in test_shake_128()
719 assert_eq!(MessageDigest::shake_128().block_size(), 168); in test_shake_128()
720 assert_eq!(MessageDigest::shake_128().size(), 16); in test_shake_128()
722 MessageDigest::shake_128().type_().as_raw(), in test_shake_128()
736 hash_xof_test(MessageDigest::shake_256(), test); in test_shake_256()
739 assert_eq!(MessageDigest::shake_256().block_size(), 136); in test_shake_256()
740 assert_eq!(MessageDigest::shake_256().size(), 32); in test_shake_256()
742 MessageDigest::shake_256().type_().as_raw(), in test_shake_256()
757 hash_test(MessageDigest::ripemd160(), test); in test_ripemd160()
760 assert_eq!(MessageDigest::ripemd160().block_size(), 64); in test_ripemd160()
761 assert_eq!(MessageDigest::ripemd160().size(), 20); in test_ripemd160()
763 MessageDigest::ripemd160().type_().as_raw(), in test_ripemd160()
777 hash_test(MessageDigest::sm3(), test); in test_sm3()
780 assert_eq!(MessageDigest::sm3().block_size(), 64); in test_sm3()
781 assert_eq!(MessageDigest::sm3().size(), 32); in test_sm3()
782 assert_eq!(MessageDigest::sm3().type_().as_raw(), Nid::SM3.as_raw()); in test_sm3()
788 MessageDigest::from_nid(Nid::SHA256).unwrap().as_ptr(), in from_nid()
789 MessageDigest::sha256().as_ptr() in from_nid()
796 MessageDigest::from_name("SHA256").unwrap().as_ptr(), in from_name()
797 MessageDigest::sha256().as_ptr() in from_name()