Forum > Windows (32/64)

Error: Project raised exception class 'External:SIGSEGV'.

<< < (21/22) > >>

karmacomposer:

--- Quote from: rvk on December 09, 2020, 05:27:27 pm ---
--- Quote from: karmacomposer on December 09, 2020, 04:57:58 pm ---Thank you for this.  So, since the data could be any size, from as small as a first name to several paragraphs in size, the above code will simply make sure
it is divisible by 16, correct?
--- End quote ---
Yes, the Data should be divisible by Cipher.BlockSize div 8 (which is 128 div 8 = 16).
TDCP_rijndael is inherited from TDCP_blockcipher128 and for that one the standard blocksize is 16, 128 bits.
So you could use Cipher.BlockSize div 8 in the code but because for rijndael it's always 128 bits (16 bytes) you can hardcode the padding to a multiple of 16 characters.

Also... if you look in TDCP_blockcipher128.EncryptCBC() you can see the encoding is done in blocks of 16.
(Set your cursor on .EncryptCBC( and press Alt+Arrow Up and then Shift+Ctrl+Arrow Down. You get right into the source there)

You can see it does blocks of 16 bytes from the for i:= 1 to (Size div 16) and Move(p1^,p2^,16);


--- Quote from: karmacomposer on December 09, 2020, 04:57:58 pm ---As far as making the key 32 bytes long, won't a 32 character key be 32 bytes long?

--- End quote ---
Yes, a 32 character long ansistring is 32 bytes long. But make sure it's an ansistring and not a utf8 string (which can be longer due to character encoding with special characters).

You could also padd the key if it's shorter than 32 characters. But that might weaken your AES encryption.


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---if (Length(Key) < 32) then  while Length(Key) < 32 do Key := Key + AnsiChar(0);Key := Copy(Key, 1, 32); // for the instance Length(Key) > 32
--- End quote ---

I get all that, though great info to be sure.  I require AES 256, so is Rijndael AES 128? How would I use it for AES 256? I require very strong encryption.

I have every intention of converting the resulting encrypted AnsiString to UTF8 after and then the reverse when decrypting.
I need to be able to transmit through SSL and I have learned that converting to UTF8 does the trick.

Mike

rvk:

--- Quote from: karmacomposer on December 09, 2020, 05:55:50 pm ---I require AES 256, so is Rijndael AES 128? How would I use it for AES 256? I require very strong encryption.
--- End quote ---
By using a 32 byte key (=256 bits), I thought.
Keysize is different than blocksize.


--- Quote ---For AES, NIST selected three members of the Rijndael family, each with a block size of 128 bits, but three different key lengths: 128, 192 and 256 bits.
--- End quote ---
https://en.m.wikipedia.org/wiki/Advanced_Encryption_Standard

PascalDragon:

--- Quote from: rvk on December 09, 2020, 05:27:27 pm ---
--- Quote from: karmacomposer on December 09, 2020, 04:57:58 pm ---As far as making the key 32 bytes long, won't a 32 character key be 32 bytes long?

--- End quote ---
Yes, a 32 character long ansistring is 32 bytes long. But make sure it's an ansistring and not a utf8 string (which can be longer due to character encoding with special characters).
--- End quote ---

Though Length will return the length in Byte, not characters or code points, so that wouldn't matter here.

Fred vS:
Hello.

In your code:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---for I := 0 to High(txtArray) do    begin      if txtArray[I] <> '' then        newArray[I] := txtArray[I]      else        newArray[I] := 'empty';    end;
I dont see before a SetLength(newArray, something);

karmacomposer:

--- Quote from: Fred vS on January 12, 2021, 08:14:29 pm ---Hello.

In your code:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---for I := 0 to High(txtArray) do    begin      if txtArray[I] <> '' then        newArray[I] := txtArray[I]      else        newArray[I] := 'empty';    end;
I dont see before a SetLength(newArray, something);

--- End quote ---

Thank you.

I rewrote the code and found the problems.

Mike

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version