| 2852 | } |
| 2853 | |
| 2854 | Vector<uint8_t> String::sha1_buffer() const { |
| 2855 | CharString cs = utf8(); |
| 2856 | unsigned char hash[20]; |
| 2857 | CryptoCore::sha1((unsigned char *)cs.ptr(), cs.length(), hash); |
| 2858 | |
| 2859 | Vector<uint8_t> ret; |
| 2860 | ret.resize_uninitialized(20); |
| 2861 | uint8_t *ret_ptrw = ret.ptrw(); |
| 2862 | for (int i = 0; i < 20; i++) { |
| 2863 | ret_ptrw[i] = hash[i]; |
| 2864 | } |
| 2865 | |
| 2866 | return ret; |
| 2867 | } |
| 2868 | |
| 2869 | Vector<uint8_t> String::sha256_buffer() const { |
| 2870 | CharString cs = utf8(); |
no test coverage detected