SHA256 Hash FString
I simply want to SHA256 an FString to send to my server. I spent the last month creating an account server that authenticates using SHA256 strings after hearing about the flaws with SHA1. I have no problems generating SHA1 with UE4 but it seems that the 256 version is implemented differently?
Everything compiles fine but crashes during runtime
Here is the function:
And the crash reports: Assertion failed: false [File:D:\Build\++UE4+Release- 4.18+Compile\Sync\Engine\Source\Runtime\Core\Private\GenericPlatform\GenericPlatformMisc.cpp] [Line: 899] No SHA256 Platform implementation
The problem line:
I haven't seen any questions asked on the forum or hub about this. I see there is a plugin or two available but I would strongly prefer not to use them. I am developing a multi-platform game and would like to use unreal's built-in hashing functions that are cross-platform compatible. I know UE4 uses SHA256 internally and there is clearly some implementation. I just don't really know what to make of that error.
Thank you so much in advance! This is a serious roadblock for me and while I could switch everything to SHA1 authentication, that would be taking a step back security-wise.
asked Jun 08 '18 at 12:45 PM in C++ Programming
Got it working.. prehaps its not best solution but its working for me.
I using the sha256.h and sha256.cpp file from zedwood function. found here http://www.zedwood.com/article/cpp-sha256-function
Jah need to insert the #define _CRT_SECURE_NO_WARNINGS in the sha256.cpp
Because the function expects std.string and not fstring .. jah need to convert them like this FString hash_user_name = *FString(sha256(TCHAR_TO_UTF8(*User_Name)).c_str());
Then jah can get the code working and jah got a nice sha256 hash signature.
answered Jan 18 '19 at 06:50 PM
Use FPlatfromMisc instead of FGenericPlatformMisc. "Generic" is fall back implementation, some of them simply crashes if something is not implemented in specific platform implementation and you hit one of such examples
What UE4 platform API work is that each platform have it own of set classes, so for example Windows have prefix FWindowsPlatform* and Android for example will have FAndroidPlatform* and during compilation the specific ser for platform that compilation happens for gets typename-ed to FPlatform, so always use FPlatform. Because this is kind of a C++ hack API reference only shows Generic platform implementation which is fallback implementation that all platform implementation inherent form and if there missing function it falls back to Generic. Some platform implementations also have some extra exclusive functions, this is only case where you not use FPlatfrom and reference platform implementation directly
answered Jun 09 '18 at 02:38 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here