K
K
Konstantin Teploukhov2022-04-04 02:29:21
Perl
Konstantin Teploukhov, 2022-04-04 02:29:21

How to rewrite code from perl to c#?

hello i have perl code

my $aes = Crypt::AuthEnc::GCM->new ("AES", $key, $iv_bin);

my $plain_text = $aes->decrypt_add  ($data);
my $result_tag = $aes->decrypt_done ($tag);

I found it via Google https://metacpan.org/pod/Crypt::AuthEnc::GCM

I started searching under c#, and I didn’t find more than 1 working example, the saddest thing is that I don’t even quite understand in perl where are the lines and where are the bytes. .. can anyone have a working implementation in c#?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Bannikov, 2022-04-04
@blood-moon

Look here:
https://docs.microsoft.com/ru-ru/dotnet/api/system...
It is not clear from your code what is a string and what is bytes, because it is not shown where the key and IV are initialized, but the key and IV are most likely byte.
$plain_text - string
$result_tag, from what I understood from the documentation - you don't need it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question