AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

One Time Pad Geschwindigkeit

Ein Thema von DelphiUser123 · begonnen am 10. Sep 2025 · letzter Beitrag vom 14. Sep 2025
Antwort Antwort
DelphiUser123

Registriert seit: 23. Feb 2013
50 Beiträge
 
#1

One Time Pad Geschwindigkeit

  Alt 10. Sep 2025, 22:59
Hallo liebes Forum.
Ich habe ein kleines One Time Pad Programm programmiert, zusätzlich zum Encodieren mit einer Schlüsseldatei wird die Ausgabe bitinvertiert. Nun stellt sich mir die Frage ob die Geschwindigkeit des Programms so okay ist.
Es dauert 1,4 Mbit/s (10,5 MB/ min) auf meinem Computer.
Vielen Dank für Hinweise.
  Mit Zitat antworten Zitat
Kas Ob.

Registriert seit: 3. Sep 2023
475 Beiträge
 
#2

AW: One Time Pad Geschwindigkeit

  Alt 11. Sep 2025, 08:33
Hi,
Hallo liebes Forum.
Ich habe ein kleines One Time Pad Programm programmiert, zusätzlich zum Encodieren mit einer Schlüsseldatei wird die Ausgabe bitinvertiert. Nun stellt sich mir die Frage ob die Geschwindigkeit des Programms so okay ist.
Es dauert 1,4 Mbit/s (10,5 MB/ min) auf meinem Computer.
Vielen Dank für Hinweise.
Are we talking about this one-time pad encryption https://en.wikipedia.org/wiki/One-time_pad

1.4Mbit/s is so slow that makes encrypting with AES then compressing with ZLib then convert it using Base64 faster at least 10 times.

Again, if we are talking about one-time pad encryption/cipher which is merely an XOR operation limited by IO, in this case it is memory access.

Here a nice paper on ResearchGate https://www.researchgate.net/publica..._Pad_Algorithm
and here some result of little optimized approach , on Page 19
Zitat:
Table 8. Speed test results with different plaintext lengths.
Length of Plaintext Verification Time
128 bits 0.203495 ms
256 bits 0.241399 ms
512 bits 0.258441 ms
1024 bits 0.287604 ms
2048 bits 0.345361 ms
4096 bits 0.421147 ms
8192 bits 0.643735 ms
So 1KB is less than 1ms making 1MB less than 1second, but judging by that table it is non-linear thus we can safely assume it will be slower than 2ms for triple/quadruple of the biggest which means 4kb it will be slower than 1ms, yet here we should not forget the L1 cache and when you hit it the performance might sliced by half at least.

I would suggest to fine benchmark it for small sizes because it make little sense to use it on huge data, then compare with that paper, if you can get half the speed then with Delphi compiler then it is great.

PS: the paper about utilizing sign-on using OTP so there is more extra work that doesn't concern your implementation, yet OTP is simple XOR based, so i think (and hope i am not wrong) you can hit tens if not hundreds of megabytes per second.
Kas
  Mit Zitat antworten Zitat
DelphiUser123

Registriert seit: 23. Feb 2013
50 Beiträge
 
#3

AW: One Time Pad Geschwindigkeit

  Alt Heute, 00:24
Zitat:
I would suggest to fine benchmark it for small sizes because it make little sense to use it on huge data,
Do you refer to the slow 1.4 Mb/s or in general?
Zitat:
then compare with that paper, if you can get half the speed then with Delphi compiler then it is great.
8192 bits in 0.643735 ms is about 12,74 Gbit/s, so do you mean I can be happy with about 6 Gbit/s?
  Mit Zitat antworten Zitat
Kas Ob.

Registriert seit: 3. Sep 2023
475 Beiträge
 
#4

AW: One Time Pad Geschwindigkeit

  Alt Heute, 07:55
Zitat:
I would suggest to fine benchmark it for small sizes because it make little sense to use it on huge data,
Do you refer to the slow 1.4 Mb/s or in general?
Zitat:
then compare with that paper, if you can get half the speed then with Delphi compiler then it is great.
8192 bits in 0.643735 ms is about 12,74 Gbit/s, so do you mean I can be happy with about 6 Gbit/s?
Ok, I think we are losing each other while translation and language barrier could play a role here.

First you didn't confirm my first question if the topic is about One-Time pad encryption/ciphering algorithm ?!
So i will assume it is, and continue based on that.

Second: One-Time pad is merely XORing the plaintext (data/message..) with key, key length must be at least equal to the length plaintext, so performing encryption and decryption should have the same speed and it is very close to the speed of memory copying, worst case scenario it would be at half of that speed.

Now to the numbers, Memory Coppy speed for modern CPUs ( last 20 years ) in giga bytes, the copy speed on my CPU (i5-2500k) is over 22 Giga bytes per second, so yes even with Delphi generated code, you should hit way higher numbers and speed against that (10,5 MB/ min) you mentioned, see, my Snappy compression implementation in Delphi can hit between 300-700 mega bytes per second (compressing/decompressing) and that without SIMD, in SIMD it can hit over 1.5 GB per second, AES in Delphi (without Assembly or AES) is between 70-300 mega bytes per second, and this AES has hundreds of XOR operation per 10-14 rounds and that only for one 16 bytes block, can you see or predict the numbers now ...?!

That being said, the One-Time pad is called unbreakable, because there is no cryptanalysis can be performed on it, but under one condition fulfilling its main and crucial condition to be called One-Time Pad, which is using True Random, and you can't use pseudorandom, and that brings us back to the speed:

Did you benchmarked the Key generation with encryption ?
Are your numbers only on Encryption and Decryption ? because it is scimple XOR over two blocks of memory

So, please read what i wrote here, and correct me if we are talking about different algorithm, in all cases think about the numbers i gave you in this very post, and forget about that paper as it might be very irrelevant to your implmentaiton, but it is th eonly one i found on the internet while searching for numbers.

PS: read the Wikipedia article and its sources, as it is crucial to be using True Random, and it is pain in the back to get it right.
Kas
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 19:34 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz