SHA-1 Encryption


Mike Bannon
 

Hi All

I need to encrypt an authorisation string for an API call using SHA-1 encryption. Can anyone tell me the best way to do this in xpa 3.3a?

TIA
Mike Bannon
DataFormation Ltd., UK


 

Hi Mike,

last year i had to create a HMAC-SHA-256 Encryption for credit card transactions. I. used the .NET system.security.cryptograph which offers all the methods


 There is also a class for SHA-1
https://learn.microsoft.com/de-de/dotnet/api/system.security.cryptography.sha1?view=net-7.0

may be this works for you

Regards
Friedrich


Mike Bannon
 

Hi Friedrich

 

Thanks for this info. Unfortunately, as I am still pretty much a .net virgin, I wouldn’t know how to go about using that utility, or the info in the link! L Could you give me an example, if it’s not too much trouble?

 

TIA

Mike Bannon

DataFormation Ltd., UK

 

 

From: main@magicu-l.groups.io [mailto:main@magicu-l.groups.io] On Behalf Of Friedrich Geisler-Buckert
Sent: 17 January 2023 12:41
To: main@magicu-l.groups.io
Subject: Re: [magicu-l] SHA-1 Encryption

 

Hi Mike,

last year i had to create a HMAC-SHA-256 Encryption for credit card transactions. I. used the .NET system.security.cryptograph which offers all the methods


 There is also a class for SHA-1
https://learn.microsoft.com/de-de/dotnet/api/system.security.cryptography.sha1?view=net-7.0

may be this works for you

Regards
Friedrich


Roberto Ramirez Cervantes
 

I would like to know that too!

--
Roberto Ramirez
marionette_66@...


On Tue, Jan 17, 2023, at 9:05 AM, Mike Bannon wrote:

Hi Friedrich

 

Thanks for this info. Unfortunately, as I am still pretty much a .net virgin, I wouldn’t know how to go about using that utility, or the info in the link! L Could you give me an example, if it’s not too much trouble?

 

TIA

Mike Bannon

DataFormation Ltd., UK

 

 

From: main@magicu-l.groups.io [mailto:main@magicu-l.groups.io] On Behalf Of Friedrich Geisler-Buckert
Sent: 17 January 2023 12:41
To: main@magicu-l.groups.io
Subject: Re: [magicu-l] SHA-1 Encryption

 

Hi Mike,

last year i had to create a HMAC-SHA-256 Encryption for credit card transactions. I. used the .NET system.security.cryptograph which offers all the methods


 There is also a class for SHA-1

may be this works for you

Regards
Friedrich




Gadi Birman
 

Hi all,

Just uploaded a nano code sample in XPA 4.8 that uses .Net to do the job.

https://magicu-l.groups.io/g/main/files/SHA1_XPA48.xml

Gadi Birman

 

I know nothing (Manuel)

Don't underestimate the power of the Source (GB)


Mike Bannon
 

Hi Gadi

 

Thanks for that, that seems to do what I need – I just wish I understood it! :-}

 

I’d like to get to grips with .NET a bit, but old dog/new tricks etc.

 

Thanks

Mike Bannon

DataFormation Ltd., UK

 

From: main@magicu-l.groups.io [mailto:main@magicu-l.groups.io] On Behalf Of Gadi Birman
Sent: 18 January 2023 09:02
To: main@magicu-l.groups.io
Subject: Re: [magicu-l] SHA-1 Encryption

 

Hi all,

Just uploaded a nano code sample in XPA 4.8 that uses .Net to do the job.

https://magicu-l.groups.io/g/main/files/SHA1_XPA48.xml

Gadi Birman

 

I know nothing (Manuel)

Don't underestimate the power of the Source (GB)


Gadi Birman
 
Edited

Hello mike,


I strongly recommend not to bump into the "old dog/new tricks" barrier.

I'm saying it from the old dog standpoint. 😊


I've just uploaded a second small code sample and GIF video that shows it at work.

The program (3) shows the Invoke DotNet along with the equivalent XPA code and remarks.

https://magicu-l.groups.io/g/main/files/SHA1_Exports_490+GIF.zip

The code is an export from XPA 4.9, but can easily be re-written in earlier XPA versions, and uses no special features of the newer XPA versions.


I hope this will help you understand the code and give you the necessary push to learn new tricks.


Good luck and all the best,

--
Gadi Birman

 

I know nothing (Manuel)

Don't underestimate the power of the Source (GB)


Mike Bannon
 

Hi Gadi

 

Thanks again for this. I’ll have to study it in more detail as soon as I have time, but after just a quick look I think I largely follow what’s going on!

 

And it imports fine into xpa 3.2, BTW J

 

Regards

Mike

 

From: main@magicu-l.groups.io [mailto:main@magicu-l.groups.io] On Behalf Of Gadi Birman
Sent: 18 January 2023 21:40
To: main@magicu-l.groups.io
Subject: Re: [magicu-l] SHA-1 Encryption

 

[Edited Message Follows]

Hello mike,


I strongly recommend not to bump into the "old dog/new tricks" barrier.

I'm saying it from the old dog standpoint. 😊


I've just uploaded a second small code sample and GIF video that shows it at work.

The program (3) shows the Invoke DotNet along with the equivalent XPA code and remarks.

https://magicu-l.groups.io/g/main/files/SHA1_Exports_490+GIF.zip

The code is an export from XPA 4.9, but can easily be re-written in earlier XPA versions, and uses no special features of the newer XPA versions.


I hope this will help you understand the code and give you the necessary push to learn new tricks.


Good luck and all the best,

--
Gadi Birman

 

I know nothing (Manuel)

Don't underestimate the power of the Source (GB)


Gadi Birman
 

Hi Mike,

Very good to know (and somewhat surprising) that the 4.9 export could be successfully imported to version 3.2 J

Thanks!
--
Gadi Birman

 

I know nothing (Manuel)

Don't underestimate the power of the Source (GB)


Roberto Ramirez Cervantes
 

Gadi,

Thank you so very much for the code. It is simple and it just works.

I actually spent a couple of days programming the SHA-512 logic using only XPA but when I got to the 80 recurring loops logic where the actual hashing magic occurs, I did not see a way to get either an improvement nor the same performance from the existing .net security library.

For me, I think this is one of the main road blocks to approach .NET; the fact that there is a security library already installed in my computer (and presumably, in all Windows computers) ready to calculate this hash, but I did not know it existed, or the path for this library, or what other libraries do I need to use, or the sequence of calls to these libraries to get the resulting hash.

Roberto


Craig Martin
 

Roberto, Roberto,

Attempting to implement SHA-512 in Magic is surely listed in DSM-5 as a psychiatric disorder.

Roberto, meet Stack Overflow. Roberto, please make the acquaintance of ChatGPT and Github CoPilot.

Yes, you can stuff square pegs into round holes, but learn to write this stuff in c# or python and you can bring it back to Magic easier.
And then decide that using Magic dotnet methods is some kind of self-flagellation.

Life is too short for this shit.

Let's have a beer in BlackCat or Din Tai Fung sometime soon.






From: main@magicu-l.groups.io <main@magicu-l.groups.io> on behalf of Roberto Ramirez Cervantes <marionette_66@...>
Sent: Friday, January 27, 2023 2:25 PM
To: main@magicu-l.groups.io <main@magicu-l.groups.io>
Subject: Re: [magicu-l] SHA-1 Encryption
 
Gadi,

Thank you so very much for the code. It is simple and it just works.

I actually spent a couple of days programming the SHA-512 logic using only XPA but when I got to the 80 recurring loops logic where the actual hashing magic occurs, I did not see a way to get either an improvement nor the same performance from the existing .net security library.

For me, I think this is one of the main road blocks to approach .NET; the fact that there is a security library already installed in my computer (and presumably, in all Windows computers) ready to calculate this hash, but I did not know it existed, or the path for this library, or what other libraries do I need to use, or the sequence of calls to these libraries to get the resulting hash.

Roberto


Heidi Schuppenhauer
 

Thank you so much for that! It just so happens I very much needed this exact thing, and it works perfectly.


Roberto Ramirez Cervantes
 

Craig,

I think your idea of becoming a shepherd for Magic developers that want to branch out and use the available resources of other programming tools\languages is excellent!
When is your first session?

Roberto


Craig Martin
 

"He's no shepherd, he's just a very naughty boy"



There's always a beer with your name on it in Snohomish, Roberto. Alternatively, Black Cat next week 🙂 





From: main@magicu-l.groups.io <main@magicu-l.groups.io> on behalf of Roberto Ramirez Cervantes <marionette_66@...>
Sent: Wednesday, February 1, 2023 1:52 PM
To: main@magicu-l.groups.io <main@magicu-l.groups.io>
Subject: Re: [magicu-l] SHA-1 Encryption
 
Craig,

I think your idea of becoming a shepherd for Magic developers that want to branch out and use the available resources of other programming tools\languages is excellent!
When is your first session?

Roberto


Todd Baremore
 

Funny, I asked the same question. Got as far as you did.
Todd
On 2/1/2023 4:52 PM, Roberto Ramirez Cervantes wrote:

Craig,

I think your idea of becoming a shepherd for Magic developers that want to branch out and use the available resources of other programming tools\languages is excellent!
When is your first session?

Roberto