Announcement

Collapse
No announcement yet.

AES encryption

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • AES encryption

    the example is bad:
    http://www.powerbasic.com/support/pb...ad.php?t=23464

    if a longer text is encoded, contains
    the cryptogram of cyclical places.

    example:
    Code:
    function pbmain&()
    
    ...
    
    plain    = chr$(&h83,&h4e,&had,&hfc,&hca,&hc7,&he1,&hb3,&h06,&h64,&hb1,&hab,&ha4,&h48,&h15,&hab, _
                    &h83,&h4e,&had,&hfc,&hca,&hc7,&he1,&hb3,&h06,&h64,&hb1,&hab,&ha4,&h48,&h15,&hab)
    
    ...
    
    end function

    result (cipher):

    &h19,&h46,&hda,&hbf,&h6a,&h03,&ha2,&ha2,&hc3,&hd0,&hb0,&h50,&h80,&hae,&hd6,&hfc,
    &h19,&h46,&hda,&hbf,&h6a,&h03,&ha2,&ha2,&hc3,&hd0,&hb0,&h50,&h80,&hae,&hd6,&hfc


    does anybody have a complete and correct aes-example of pb?



    [this message has been edited by bernhard fomm (edited september 19, 2005).]

  • #2
    Have a look at http://www.pbcrypto.com/

    Maybe that will help.

    ------------------
    JADT
    JADT

    Comment


    • #3
      A du Toit:

      It is the same source text.

      Comment


      • #4
        I switched over to using HIME. Perhaps you might want to give it
        a try?
        http://www.devotechs.com/

        ------------------
        Mac Application Reviews and More

        Comment


        • #5
          The example is bad:
          The example is fine. Of course your ciphertext contains repeated strings. You've
          encrypted a plaintext string whose length is %BLOCKSIZE * 2.

          I switched over to using HIME.
          A good idea. Its author is Eddy Van Esch. He knows how to implement encryption properly.


          ------------------

          Comment


          • #6
            Nothing may recur in cryptograms!

            What do I have to change in the
            source text so that all OK is?

            How can I contact Eddy Van Esch?

            Comment


            • #7
              Hi Bernhard.

              See e-mail address below or through my website www.devotechs.com

              Kind regards


              ------------------
              Eddy
              email: raimundo4u at yahoo dot com
              www.devotechs.com -- HIME Huge Integer Math and Encryption library--
              Eddy

              Comment


              • #8
                Eddy does know how to implement it properly and for a very
                small fee you can get the HIME source code as well and can
                learn from it.

                BTW, Greg has some amazing encryption algo's so no disrespect
                intended. For me at least (I can't speak for anyone else) the
                problem was my implementation. As a HIME user, I now know what
                I did wrong.



                -Ken

                ------------------
                Mac Application Reviews and More

                Comment


                • #9
                  Hi Eddy.

                  Are the AES-cryptograms of different programs compatible?
                  Are there hime-examples for the safe implementation of AES-routines?

                  Kind regards from Munich

                  [This message has been edited by Bernhard Fomm (edited September 20, 2005).]

                  Comment


                  • #10
                    Are the AES-cryptograms of different programs compatible?
                    By 'cryptograms' I assume you mean 'ciphertext'?
                    The short answer is: 'Yes, if..'
                    But it is a big 'if'.

                    You see, AES (like DES, 3DES, CAST, Blowfish, Twofish, Serpent, ) is a block cipher.
                    This means that it can only encrypt plaintext of a certain fixed length. 16 bytes in the case of AES.
                    In this basic form, it has limited use, because most of the time your plaintext will not be exactly 16 bytes long.

                    That's why there exist a number of ways to deal with this limitation:

                    The simplest method is named ECB (Electronic Code Book):
                    You add a number of bytes ('padding') so that your plaintext length becomes a multiple of the block size (16 bytes for AES).
                    You split up the plaintext in n blocks of each 16 bytes long. Every block is encrypted and concatenated to form the ciphertext.
                    After decryption, the padded bytes are removed from the plaintext.
                    So, the ciphertext must contain extra data to know how many bytes were padded.
                    Every encryped block is independant from any other encrypted block.

                    There are several other methods, where the plaintext blocks are combined with other datablocks, usually the ciphertext of the previously encrypted plaintext block.
                    Most know methods are:
                    - CIPHER BLOCK CHAINING MODE (CBC)
                    - CIPHER FEEDBACK MODE (CFB)
                    - OUTPUT FEEDBACK MODE (OFB)
                    - COUNTER MODE (CTR)

                    These methods have the benefit over ECB mode that the ciphertext of a certain block is influenced by the previously encrypted blocks.

                    The tricky part for the first 3 methods is that, for the first encryped block, the plaintext is combined with a so-called 'Initial Vector' or IV.
                    The user can freely determine what this IV is. It does not even have to be kept a secret.
                    Depending on what IV you choose, your entire ciphertext looks different.

                    Which of the different block cipher methods (except ECB) is the 'best', is usually a matter of personal preference. I have never seen any real objective arguments why one should be better than the other. Most experts agree that CBC is very safe.

                    So, even if 2 people use the same block cipher mode for AES (CBC, ... all except ECB) and the same password and the same plaintext, still the ciphertext will look different if they use a different IV... This is the 'if' bit for all cipher block modes except for ECB.

                    For ECB the 'if' bit lies in the way that the plaintext is padded. If padding is different between 2 users, the last ciphertext block will be different. The rest of the ciphertext blocks will be equal. (when using same password of course ...)


                    HIME supports AES in ECB and CBC modes and single block encryption (and decryption).
                    The basic AES block cipher routine is Greg Turgeons code. I have complete faith in Gregs code ..

                    Are there hime-examples for the safe implementation of AES-routines?
                    The HIME helpfile contains sample code of how to use the various functions.
                    If you use HIMEs AES encryption functions, the only safety you have to worry about is how to deal with the password. Where are you going to store it etc.

                    Don't know if this answers your questions.. If not, just ask ..

                    Kind regards


                    ------------------
                    Eddy
                    email: raimundo4u at yahoo dot com
                    www.devotechs.com -- HIME Huge Integer Math and Encryption library--
                    Eddy

                    Comment


                    • #11
                      Hello Eddy

                      I have understood. Thanks.

                      Comment


                      • #12
                        For a programmer, Bruce Schneier's _Applied Cryptography_ offers the best introduction available anywhere. Other books on cryptography seem to stress the math involved or the information theory aspects of the process. Although Schneier doesn't ignore such issues, he focuses mostly on encryption as a process, one that can be secure or not, and he explains nicely the reasons why complexity does not necessarily imply security.


                        ------------------

                        Comment

                        Working...
                        X