1 2 Previous Next 18 Replies Latest reply: Sep 21, 2007 3:24 PM by 807592 RSS

    Simple algorithm to encrypt a file

    807590
      Hi
      Does anyone know a simple algorithm to encrypt a file using java code? and please provide me the reverse code to de-encrypt the file.
      I know the is a lot of advance code that is better, but I need this for non-commercial reasons.

      Thanks for help in advance
      Ridwan
        • 1. Re: Simple algorithm to encrypt a file
          796440
          [url http://java.sun.com/j2se/1.4.2/docs/guide/security/CryptoSpec.html]Java Cryptography Architecture
          [url http://java.sun.com/j2se/1.4.2/docs/guide/security/jce/JCERefGuide.html]Java Cryptography Extension (JCE) Reference Guide for the J2SE SDK, v 1.4
          Java 2 Cryptography Extension: Encrypting and Decrypting Data
          Security in Java 2 SDK 1.2
          Master the basics of Java Cryptography Extension (JCE)


          Or you could try to do some of your own work and google for something like java encryption example.
          • 2. Re: Simple algorithm to encrypt a file
            807590
            Ok thanks but I just need a sime algorithm please. It's not for the job
            Thanks
            • 3. Re: Simple algorithm to encrypt a file
              796440
              Ok thanks but I just need a sime algorithm please.
              Then either google for one or skim those links to finthe basic pieces.

              You haven't said anything about your requirements for this "simple algorithm," so I'm not going to waste my time guessing at what might or might not be appropriate for you.

              As an extreme example: Try ROT13.
              • 4. Re: Simple algorithm to encrypt a file
                807590
                I just need a sime algorithm please.
                dont try to re-invent the wheel .

                do you want to encrypt in a simple way ? do you want people to decrypt in a simple way ? do you want any people can decrypt in a simple way ?
                • 5. Re: Simple algorithm to encrypt a file
                  807590
                  Well all, Iisten, I want a simple algorithm of encrypting a file not to use it in my code but just as an example as that used at university please. I need to know the basic Iidea of how to encrypt files. In JDK we know how to write and read files we know how to encrypt files using advance algorithms that are ready, but how to write such algorithms
                  • 6. Re: Simple algorithm to encrypt a file
                    796440
                    Well all, Iisten, I want a simple algorithm of
                    encrypting a file not to use it in my code but just
                    as an example as that used at university please.
                    I gave you one: ROT13.


                    I
                    need to know the basic Iidea of how to encrypt files.
                    Then you should study something about encryption, and search the web for examples. You're just asking others to do your work for you, and not even bothering to explain what you need--you're just expecting others to figure that out for you too.


                    In JDK we know how to write and read files we know
                    how to encrypt files using advance algorithms that
                    are ready, but how to write such algorithms
                    Why do you need to create a new algorithm? Why not just use the ones already provided with Java?
                    • 7. Re: Simple algorithm to encrypt a file
                      796440
                      Well all, Iisten, I want a simple algorithm of
                      encrypting a file not to use it in my code but
                      just
                      as an example as that used at university please.
                      I gave you one: ROT13.
                      Here's another one: XOR every byte with 0xFF.
                      • 8. Re: Simple algorithm to encrypt a file
                        807590
                        how to write such algorithms.
                        see, it depends upon you. you have to encode , decode by your own way....is not it ? you would be responsible for this.

                        you could read a book on image processing , you'll find lots of encode/decode algo there......may be that could be helpful.

                        http://www.icaen.uiowa.edu/%7Esonka/ps-files/book-cover.gif

                        i read this book for image processing work.......quite good book.

                        But again, that is for image processing.
                        • 9. Re: Simple algorithm to encrypt a file
                          807590
                          You could just make up your own encryption algorithm.... It's not hard at all... use your imagination, take every character and do stuff to it. You can switch the location of characters, increment their value by different numbers every time, you could do anything you want
                          • 10. Re: Simple algorithm to encrypt a file
                            796440
                            You could just make up your own encryption
                            algorithm.
                            Yeah, he could.

                            I'm still trying to understand why he'd want to, rather than just using what's already available.
                            • 11. Re: Simple algorithm to encrypt a file
                              807590
                              I always like to do my own code for everything, even if there's such a class already. But maybe just because I'm a beginner so I want to practice, it helps me understand better the class if I create it. So he might want to make it himself, and plus I don't know how the java encryption works, but maybe if you use it, other java users can decrypt it. But I have no idea
                              • 12. Re: Simple algorithm to encrypt a file
                                796440
                                I always like to do my own code for everything, even
                                if there's such a class already. But maybe just
                                because I'm a beginner so I want to practice, it
                                helps me understand better the class if I create it.
                                So he might want to make it himself,
                                Then he should do that. But he's not. He's asking somebody to provide him with a "simple algorithm"--which is a horrible requirements statement.


                                and plus I don't
                                know how the java encryption works, but maybe if you
                                use it, other java users can decrypt it. But I have
                                no idea
                                That's why I posted links--so he could learn.
                                • 13. Re: Simple algorithm to encrypt a file
                                  807590
                                  I always like to do my own code for everything, even
                                  if there's such a class already. But maybe just
                                  because I'm a beginner so I want to practice, it
                                  helps me understand better the class if I create it.
                                  As a learning exercise this is great.
                                  So he might want to make it himself,
                                  The why is he asking US to write it for him? He has been given a load of references that give examples.
                                  and plus I don't
                                  know how the java encryption works,
                                  I do (or at least much of it) - but I had to spent a significant time in learning about it. One cannot just code! One has to learn about what one is coding.
                                  but maybe if you
                                  use it, other java users can decrypt it. But I have
                                  no idea
                                  • 14. Re: Simple algorithm to encrypt a file
                                    807592
                                    Hola a todos tengo un problema al encriptar archivos en java he encontrado algoritmos que los encriptan pero al desencriptarlos me duevuelven null. Si alguien sabe de algun algoritmo que lo haga por favor me podria decir como hacerlo o alguna pagina de referencia.

                                    Adios hasta luego y muchas gracias de antemano
                                    1 2 Previous Next