How to Calculate RSA (SHA256) hash based on a given public key

312 views
Skip to first unread message

Eric Lendvai

unread,
Oct 25, 2022, 4:08:45 PM10/25/22
to Harbour Users
Anyone has any harbour code to Calculate RSA (SHA256) hash based on a public key?
Thanks, Eric

tarpauwatratar

unread,
Nov 4, 2022, 1:28:03 PM11/4/22
to Harbour Users
Looks like no one has experience in that field. Because of that let me mention the workaround: You can always use one of the existing implementations in C and do sth like that:

#include "hbapi.h"
#include "hbapiitm.h"

HB_FUNC( FUNCTION_NAME_IN_HARBOUR )
{
    PHB_ITEM pFirstParam = hb_param(1, HB_IT_STRING);
    PHB_CODEPAGE cdp = hb_vmCDP();
    const char* pFirst = hb_itemGetCPtr(pFirstParam);

    //magic in C - You have a public key in the pFirst variable

    hb_retnc(result);
}

I'm not sure of the correctness of the above pattern, but it would be my starting point.

Gerald Drouillard

unread,
Nov 4, 2022, 1:38:45 PM11/4/22
to harbou...@googlegroups.com
You do know that harbour has:
hb_sha256, and hb_hmac_sha256

--
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: https://groups.google.com/group/harbour-users
---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/harbour-users/a97c5403-fe44-4ff0-b884-b5a03fb87810n%40googlegroups.com.

axtens

unread,
Jun 10, 2024, 2:10:33 AMJun 10
to Harbour Users
https://crypto.stackexchange.com/questions/18695/does-sha-1024-hash-exist implies that the function probably doesn't exist and would be overkill in the extreme

-Bruce

juanpere...@gmail.com

unread,
Jun 10, 2024, 2:33:10 AMJun 10
to Harbour Users
Hello

Minigui has the hbcrypto library which has hash of 256 and 512

libreria.jpg

Reply all
Reply to author
Forward
0 new messages