Go Back   Sat Universe > Encryptions > Encryptions chat

Note: Visitors from certain countries might see in-text advertising(underlind words in posts) or pop-under ads.
It is only shown to unregistered visitors or members that haven't made any posts. So you can easily get rid of it.

World-Of-Satellite

Encryption Learning - Code Exercise Area

Encryptions chat

Reply
  #11  
Old 15-01-2022, 15:52  Translate from English to Italian  Translate from English to French  Translate from English to German  Translate from English to Spanish  Translate from English to Dutch  Translate from English to Greek  Translate from English to Portuguese  Translate from English to Russian  Translate from English to Russian
cayoenrique cayoenrique is offline
Linux advisor
Senior Member
 
Join Date: May 2018
Posts: 443
Thanks: 296
Thanked 709 Times in 253 Posts
Country: Country Flag
Default

1rst and most important. Do not have to apologize.
As I said, the only smart guy here is you, the one asking. Those that do not ask, will never find the answer to their unknown.

Now I did not went into basic C for you. But for the many that may read silently in the background. This is the reason I split this part on a different thread.

Now I am not sure I had answer your question:
Quote:
Originally Posted by Me2019H View Post
Hello,
from where you get this permutation table to get the keys
0x12,0x24,0x09,0x07,0x2A,0x31,0x1D,0x15,0x1C,0x36,0x3E,0x32, 0x13,0x21,0x3B,0x40,
0x18,0x14,0x25,0x27,0x02,0x35,0x1B,0x01,0x22,0x04,0x0D,0x0E, 0x39,0x28,0x1A,0x29,
0x33,0x23,0x34,0x0C,0x16,0x30,0x1E,0x3A,0x2D,0x1F,0x08,0x19, 0x17,0x2F,0x3D,0x11,
0x3C,0x05,0x38,0x2B,0x0B,0x06,0x0A,0x2C,0x20,0x3F,0x2E,0x0F, 0x03,0x26,0x10,0x37,

first key in decimal
18,44,09,07,42,49,29,21


i'm trying to understant the code
Let me rephrase.
The original key1 have 8 bytes. But each byte has 8 bit. This means 8 * 8 = 64 bit Total in original key.

The table is a way to represent how we are going to shift each one of those bits. As you saw we need 56 tolal keys.

The last 8 operations are the original keys kk[48]-kk[55]. So we in fact only need 48 new keys as ( 56 - 8 = 48 ). How do we get them? We use the table to know how we shift each bit position. This is done 48 times to get kk[0]-kk[47].

So table is just a way to shift each bit of the total 64. It provides a new position for each bit. Those generating a new byte.
Reply With Quote
  #12  
Old 15-01-2022, 16:47  Translate from English to Italian  Translate from English to French  Translate from English to German  Translate from English to Spanish  Translate from English to Dutch  Translate from English to Greek  Translate from English to Portuguese  Translate from English to Russian  Translate from English to Russian
cayoenrique cayoenrique is offline
Linux advisor
Senior Member
 
Join Date: May 2018
Posts: 443
Thanks: 296
Thanked 709 Times in 253 Posts
Country: Country Flag
Default

Now I want you to realize what intention the developer has in mind when he added this simple 64 long table.

Lets take colibri's subroutine and estimates how many PU operations & PU cycles are required,

there are 48 operations
Code:
ksfull[0] = 0 ^ ( ( eq1 ) | ( eq2 ) | ( eq3 ) | ( eq4 ) | ( eq5 ) | ( eq6 ) | ( eq7 ) | ( eq8 ) );
each ( eqn ) is of the form

Code:
((cw[x] & bit) << pos)
cw[x] => Arrays are in Local memory. This imply that PU needs to read a value from Local memory. This is 1 read but because is in Local memory requires 10 PU Cycles. This has a weight of 10 cycles.

& bit => 1 PU Op = 1 cycle

<< pos => 1 PU Op = 1 cycle

So the following requires 12 cycles. But because they are 8 per line total are 8 * 12 = 96 cycles.
Code:
((cw[x] & bit) << pos)
| - There are 7 ors So 7 more op meaning 7 Cycles.

0 ^ - We can not forget this hidden op, 1 more Cycle

ksfull[0] = Last we need to storage in array. Local memory. So 10 more cycles. ( note storing may require more cycles than reading, normally twice. lets ignore that).

So what is the total wait time consequence per Line.
Total Cycles = 96 + 7 + 1 + 10 = 114 cycles per byte. To make it symple lets say every line uses same. So 56 bytes requiring 114 cycles each or
Gran total = 56 * 114 = 6384 cycles.

See when the developer included 1 table. It not only prevented a smart Math Boy to use equations. The developer also added a waist time per PU of 6384 cycles if we try to use Local memory.

What will happen if instead of we try to use the original subroutine. Lets ignore other operations, lets concentrate in just Reading and writing.

56 * ( Read to Global memory + Write to Global memory )

56 * ( 1000 cycles + 1000 cycles ).

Total = 11200 cycles.

And Let me remind you that because randomness lets imagine at least 1 of every 10 will try to read to same memory, because is same value. This means 63 PU waits while 1 read just because it wants to read same value.

11200 / 10 * 63 = 70560 cycles. A lot !! But because we are only imagine it lest say it is only 1 / 10. Just to be safe

11200 / 10 * 63 / 10 = 7056 cycles.

So total waited time reading to Global memory is

11200 + 7056 = 18256 cycles.

This 18256 cycles do not count for the needed operations to get for the values. You know those loops and sums that you see in my original subroutine.

See Just adding a table the developer took out GPU and slow it down 20,000 cycles if we do use that table..... make you think uuhuuu!!!

Now in time this is not much.

Lets use a moderate GPU. GTX-1070 1920 PU Core @ 1506 MHz

20000 cycles / 1920 PU / 1506 cycles per second per PU =

0.00691 seconds. Yes as you see 2000 is big but in time is only 1/150 of a second for the GPU.


I know more confusion. Sorry.

Here is the important to remember.
Developers of encryption will use substitution tables as much as the can. As it will slow us hackers in hour attempt to do brute-force.

Last edited by cayoenrique; 15-01-2022 at 16:52..
Reply With Quote
The Following 2 Users Say Thank You to cayoenrique For This Useful Post:
dvlajkovic (16-01-2022), Me2019H (15-01-2022)
  #13  
Old 16-01-2022, 06:18  Translate from English to Italian  Translate from English to French  Translate from English to German  Translate from English to Spanish  Translate from English to Dutch  Translate from English to Greek  Translate from English to Portuguese  Translate from English to Russian  Translate from English to Russian
cayoenrique cayoenrique is offline
Linux advisor
Senior Member
 
Join Date: May 2018
Posts: 443
Thanks: 296
Thanked 709 Times in 253 Posts
Country: Country Flag
Default

2nd CSA Stream Cypher

As you see I am splitting all. So that the newbie can look and understand only the new code. At the end I will provide the Full CSA_Core program.

See attachement
Attached Files
File Type: tar csa_core_018_stream_cypher.tar.xz.tar (9.2 KB, 4 views)
Reply With Quote
The Following 2 Users Say Thank You to cayoenrique For This Useful Post:
dvlajkovic (16-01-2022), Me2019H (16-01-2022)
  #14  
Old Yesterday, 06:04  Translate from English to Italian  Translate from English to French  Translate from English to German  Translate from English to Spanish  Translate from English to Dutch  Translate from English to Greek  Translate from English to Portuguese  Translate from English to Russian  Translate from English to Russian
cayoenrique cayoenrique is offline
Linux advisor
Senior Member
 
Join Date: May 2018
Posts: 443
Thanks: 296
Thanked 709 Times in 253 Posts
Country: Country Flag
Default

Ok Here is the Block Cypher. Clearly it also have the Key Schedule as we need it.
Attached Files
File Type: tar csa_core_019_key_shedule+BlockCypher.tar.xz.tar (9.0 KB, 4 views)
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 14:37.


Powered by vBulletin
Copyright ©2006-2019 - Sat Universe