I would like to compute the sha256 digest on a string. Is it safe to compute the hash on the main ui thread? Or do i have to run this in the background?
Asked
Active
Viewed 39 times
1
-
How long is the string? – CommonsWare Dec 12 '17 at 23:36
-
@CommonsWare The string is 12 chars. – prostock Dec 13 '17 at 00:07
1 Answers
3
I'm not completely clear why you're hashing such a short string — the hash will be significantly larger than the input — but that should be very fast. You might run some tests to confirm that, but I expect that you can do that on the main application thread without issue.

CommonsWare
- 986,068
- 189
- 2,389
- 2,491