Ciphers

All topics about coding, designing, etc. goes in here.
Post Reply
Rajiv
Registered User
Posts: 2178
Joined: 03 Dec 2010, 20:26

Ciphers

Post by Rajiv »

Hey guys - I need some regarding ciphers! First of all - how do you generate a cipher?
"Because I don't say it...don't mean I ain't thinking it!"
Hman
Registered User
Posts: 28520
Joined: 06 Oct 2003, 02:00
Processor: Intel i5 650
Motherboard: Asus P7H55-M LX
Graphics card: Gigabyte 7850 2GB OC
Memory: 8GB Kingston DDR3
Location: In my skin
Contact:

Re: Ciphers

Post by Hman »

You don't generate a cipher, a cipher generates you.

http://en.wikipedia.org/wiki/Cipher
"Every thinking man is a drinking man."


Member of the Barberton Tigers
Monty
Forum Moderator
Posts: 10000
Joined: 05 Feb 2004, 02:00
Processor: Intel i5-4690K @ 4.5GHZ
Motherboard: ASUS Maximus VII Formula
Graphics card: ASUS GTX970 Strix
Memory: 4 x 4GB Corsair Dominators
Location: Messing with your Mind
Contact:

Re: Ciphers

Post by Monty »

dtpqwnkts
Art Williams wrote:I'm not telling you it is going to be easy, I'm telling you it's going to be worth it.
Rajiv
Registered User
Posts: 2178
Joined: 03 Dec 2010, 20:26

Re: Ciphers

Post by Rajiv »

Phew. This is gonna take a long time to grasp...
"Because I don't say it...don't mean I ain't thinking it!"
Bladerunner
Registered User
Posts: 14338
Joined: 04 Sep 2004, 02:00
Processor: i386DX Sooper
Motherboard: A blue one
Graphics card: A red one
Memory: Hard drive
Location: On a Möbius strip
Contact:

Re: Ciphers

Post by Bladerunner »

Rajiv wrote:Phew. This is gonna take a long time to grasp...
What exactly do you need a cipher for?
If I weren't insane: I couldn't be so brilliant! - The Joker
Rajiv
Registered User
Posts: 2178
Joined: 03 Dec 2010, 20:26

Re: Ciphers

Post by Rajiv »

Its an IT project. We need to do research and stuff - then we need to code a program in Java that can encrypt and decrypt a file...
"Because I don't say it...don't mean I ain't thinking it!"
User avatar
rustypup
Registered User
Posts: 8872
Joined: 13 Dec 2004, 02:00
Location: nullus pixius demonica
Contact:

Re: Ciphers

Post by rustypup »

you're writing your own security provider classes or is this simply an attempt to introduce you to the security API?
  • 1) Pick a cipher: Asyncrhonous/Synchronous
    2) Use the security API to create the necessary digests/keys
You may want to spend some time understanding what Base64 conversion is and why it is a necessary component when dealing with encrypted IO...
Most people would sooner die than think; in fact, they do so - Bertrand Russel
Bladerunner
Registered User
Posts: 14338
Joined: 04 Sep 2004, 02:00
Processor: i386DX Sooper
Motherboard: A blue one
Graphics card: A red one
Memory: Hard drive
Location: On a Möbius strip
Contact:

Re: Ciphers

Post by Bladerunner »

Rajiv wrote:Its an IT project. We need to do research and stuff - then we need to code a program in Java that can encrypt and decrypt a file...
How big are the files? Can you load it into a byte array and shift it?
If I weren't insane: I couldn't be so brilliant! - The Joker
RuadRauFlessa
Registered User
Posts: 20576
Joined: 19 Sep 2003, 02:00
Location: Bloodbank

Re: Ciphers

Post by RuadRauFlessa »

Bladerunner wrote:
Rajiv wrote:Its an IT project. We need to do research and stuff - then we need to code a program in Java that can encrypt and decrypt a file...
How big are the files? Can you load it into a byte array and shift it?
Exactly what you will be doing. The encryption APIs of Java work from Streams. It could be a buffered byte array or not it does not matter.
:rock: :rock: :rock: :rock: :rock: :rock: :rock: :rock: :rock: :rock:
Spoiler (show)
Intel Core i7-2600k @ 3.4GHz
Corsair Vengence 2x4GB DDR3 2000MHz
Thermaltake Toughpower 850W
ASUS nVidia GTX560 1GB
CoolerMaster HAF 932
Bladerunner
Registered User
Posts: 14338
Joined: 04 Sep 2004, 02:00
Processor: i386DX Sooper
Motherboard: A blue one
Graphics card: A red one
Memory: Hard drive
Location: On a Möbius strip
Contact:

Re: Ciphers

Post by Bladerunner »

RuadRauFlessa wrote:
Bladerunner wrote:
Rajiv wrote:Its an IT project. We need to do research and stuff - then we need to code a program in Java that can encrypt and decrypt a file...
How big are the files? Can you load it into a byte array and shift it?
Exactly what you will be doing. The encryption APIs of Java work from Streams. It could be a buffered byte array or not it does not matter.
Yes but if it's a big file you'd rather take a bunch of bytes at a time, encrypt them, and write them to a new file. When you're done with all the segments you close the filestream.

If it's small, like a text file or word doc, you could probably load the whole file into a byte array.
If I weren't insane: I couldn't be so brilliant! - The Joker
Rajiv
Registered User
Posts: 2178
Joined: 03 Dec 2010, 20:26

Re: Ciphers

Post by Rajiv »

It would be a small file based on my problem statement.
The rubric for the project says I need to state the inputs, processing and the outputs. The input would be the file that needs to be encrypted/decrypted, right?
How do I structure the 'processing' part and the 'output' part?
"Because I don't say it...don't mean I ain't thinking it!"
User avatar
rustypup
Registered User
Posts: 8872
Joined: 13 Dec 2004, 02:00
Location: nullus pixius demonica
Contact:

Re: Ciphers

Post by rustypup »

there are millions of examples out there...

the trick is understanding what best practices are and why they're considered best practices... (just be thankful you weren't asked to deploy a CA and fiddle with SSL)..

you may also want to consider playing with something like bouncycastle - purely because the legal wrangling in yank-land sees java shipped with a severely limited provider implementation...

have you ever dabbled in cryptography or is this your first visit? - because there's a lot of groundwork you need to cover...
Most people would sooner die than think; in fact, they do so - Bertrand Russel
Rajiv
Registered User
Posts: 2178
Joined: 03 Dec 2010, 20:26

Re: Ciphers

Post by Rajiv »

first visit...
"Because I don't say it...don't mean I ain't thinking it!"
User avatar
rustypup
Registered User
Posts: 8872
Joined: 13 Dec 2004, 02:00
Location: nullus pixius demonica
Contact:

Re: Ciphers

Post by rustypup »

symmetric
  • :-fast and far more secure
    :-security relies on trust between parties, (shared password/key)
    :-typically used on large amounts of data
    :-susceptible to volume attacks
asymmetric
  • :-slow
    :-security is adaptive and can be negotiated on the fly using disposable key-pairs..
    :-typically used on small data sets
    :-susceptible to digest and volume attacks...
in the real world you will generally encounter a blend of the 2... an asymmetric session would be used to exchange some form of salting data in order for both parties to create a disposable symmetric cipher for that session...

because the salt is random it has the appearance of noise so even if the asymmetric cipher is compromised there's a relatively low risk of having the symmetric cipher compromised as well...

by the sound of things, your project would be best suited to the symmetric cipher approach? - asymmetric would require that you store/share the private/public keys...
Most people would sooner die than think; in fact, they do so - Bertrand Russel
Rajiv
Registered User
Posts: 2178
Joined: 03 Dec 2010, 20:26

Re: Ciphers

Post by Rajiv »

OK thanks. Any more info?
"Because I don't say it...don't mean I ain't thinking it!"
User avatar
rustypup
Registered User
Posts: 8872
Joined: 13 Dec 2004, 02:00
Location: nullus pixius demonica
Contact:

Re: Ciphers

Post by rustypup »

Jav Cryptography Extension - Reference Guide - simple encryption... (although i would advise using AES over DES...)

i wasn't kidding.. this example is reproduced everywhere...
Most people would sooner die than think; in fact, they do so - Bertrand Russel
Rajiv
Registered User
Posts: 2178
Joined: 03 Dec 2010, 20:26

Re: Ciphers

Post by Rajiv »

Thank you!!!!! That info is what I need for the 3rd step of my project!!!!!
"Because I don't say it...don't mean I ain't thinking it!"
Post Reply