diff options
| author | Rémi Verschelde | 2016-06-24 21:16:20 +0200 |
|---|---|---|
| committer | GitHub | 2016-06-24 21:16:20 +0200 |
| commit | d52fa2e0ebc5eec796d243286494afae55d3a31a (patch) | |
| tree | 393cafbae2e727bebe9ae3c4be9a40568789780a /core/ustring.cpp | |
| parent | 06c6516604696c294df2e374ba8433efee54912c (diff) | |
| parent | 6776fa63de4d96f043c1e970ee366a865d46da27 (diff) | |
| download | godot-d52fa2e0ebc5eec796d243286494afae55d3a31a.tar.gz godot-d52fa2e0ebc5eec796d243286494afae55d3a31a.tar.zst godot-d52fa2e0ebc5eec796d243286494afae55d3a31a.zip | |
Merge pull request #5380 from vnen/string-canvasitem-docs
Documentation for String and CanvasItem
Diffstat (limited to 'core/ustring.cpp')
| -rw-r--r-- | core/ustring.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/core/ustring.cpp b/core/ustring.cpp index 4dbe41890..3c22de35f 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -2416,6 +2416,23 @@ Vector<uint8_t> String::md5_buffer() const { return ret; }; +Vector<uint8_t> String::sha256_buffer() const { + CharString cs = utf8(); + unsigned char hash[32]; + sha256_context ctx; + sha256_init(&ctx); + sha256_hash(&ctx, (unsigned char*)cs.ptr(), cs.length()); + sha256_done(&ctx, hash); + + Vector<uint8_t> ret; + ret.resize(32); + for (int i = 0; i < 32; i++) { + ret[i] = hash[i]; + } + + return ret; +} + String String::insert(int p_at_pos,String p_string) const { |
