Welcome to Laser Pointer Forums - discuss green laser pointers, blue laser pointers, and all types of lasers

LPF Donation via Stripe | LPF Donation - Other Methods

Links below open in new window

ArcticMyst Security by Avery

How do I make an text encyrption program in C++

lazer

0
Joined
Dec 21, 2008
Messages
361
Points
0
I want to make a program using C++ that will allow me to type in some text and the program will automatically encrypt it and provide a decryption key. I also want to be able to then type in the encryted text and have it decrypt it for me. I havent used C++ very much and am still kind of new. If anyone has some code that could help me do this, that would be great.
 





Joined
Oct 19, 2009
Messages
27
Points
0
hey lazer!

i can programm in c very good! and in c++ there is not much other!
i have the source code for this program on my school-server! it encrypt the program with a asci-code based position key!

when you typ in:
ABC (in ascii 65-66-67) and you take as key 8, then it will encrypt it so:

A+8+0=72
B+8+1=74
C+8+2=76

and the result are only letters!

the good:
when you delete only one sign, the whole text is destroyed!

it cans both, lower and upper ;)

when you would have it, i can send it you tomorrow!

regards
 
Last edited:

lazer

0
Joined
Dec 21, 2008
Messages
361
Points
0
do you have the code? Can you send it to me or post it here in this thread?
 
D

Deleted member 8382

Guest
honestly, adding 8 to the ASCII table is really poor, it will look like with a key of 2:

Hello I'm Albert

Jgnnq G'o Cndgtv

If somone sees the "G'o" it's not hard to see it's "I'm".

At least try to encode the spaces too!
 
Joined
Oct 19, 2009
Messages
27
Points
0
do you have the code? Can you send it to me or post it here in this thread?
yes, i can post it on friday, ok?

honestly, adding 8 to the ASCII table is really poor, it will look like with a key of 2:

Hello I'm Albert

Jgnnq G'o Cndgtv

If somone sees the "G'o" it's not hard to see it's "I'm".

At least try to encode the spaces too!

no, it adds as special the position! so it would be:
Hello ==>
H+2+0=J
e+2+1=h
l+2+2=p
l+2+3=q
o+2+4=u

encodet: Jhpqu

so, when you delete one letter, the whole text is incorrectly!

and i have it so make it, that it always would be ascii-letters! and encryt the space is a good idee, but how, any idees?
 
D

Deleted member 8382

Guest
Of course, encode the spaces using any algorithm that use the ascii code of the letters next to it divided by 2 for instance ;)
 
Joined
Oct 19, 2009
Messages
27
Points
0
Of course, encode the spaces using any algorithm that use the ascii code of the letters next to it divided by 2 for instance ;)

it is a nice idee...

maybe i make it as a zero-byte, that wouldn´t displayed in editors, when i remeber correctly :confused:
this is easier ;)
 
Joined
Feb 28, 2008
Messages
1,809
Points
0
go with RSA. Choose a 128 digit prime number, and another 128 digit prime number... well here just read this.

RSA - Wikipedia, the free encyclopedia

modular arithmatic just means that once you get past the modulus it goes back to 0, so 5 mod 2 would be 3. 18 mod 3 would be 0.

RSA is what our internet security, credit cards, banks, digital encryption, government encryption, etc use. Basically there is no good way to factor very large numbers that are only divisible by 2 prime numbers. If you can think of a way then you'll destroy the world's economy.

(I really like my Crypto class in college)

This is the RSA public key and exponent for the SSL certificate on HighTechDealZ.com

Modulus (2048 bits): (in hex)
b0 36 7c 80 ce 5b 43 f4 6b b7 b2 58 b3 79 5c 91
36 14 43 5c 23 10 e4 2e c1 c6 47 1a 96 00 e6 be
47 b7 ab 79 af 54 b2 4f e1 b8 3e a0 20 d6 86 32
9d 2a 87 33 d4 a1 87 40 2f a3 b7 37 e5 8c bb c0
9a 0c f7 e4 97 8d 75 71 5b c6 d2 c7 1e d7 ac 62
93 7a a6 2c 2a dc 65 3a 15 d8 06 50 0a 9a 72 dc
f7 d0 f6 78 9f 11 04 7e ae 41 34 bf 93 61 ac ce
46 0b 0f ff 81 d3 d6 69 c2 61 b8 cd dc bf e7 19
b0 d7 db ad 5e af 23 72 c7 b6 28 0b 70 1d 06 6f
28 55 61 9b 62 f8 f2 d9 e9 a0 2c 86 7d c3 71 60
07 9e ce b5 98 04 7d f9 53 d7 73 f1 72 88 10 cf
76 7e 60 7a 49 63 56 86 41 ea 26 52 13 c0 90 ef
01 69 ed f4 25 ad d6 b6 f2 c8 3d d3 fc 98 83 20
19 72 34 55 3f e3 cd 24 2d 45 66 5e bc d5 80 fd
41 6f 1f 72 36 f1 30 16 a3 61 a6 80 48 5d 67 c6
a7 2f 5f 75 25 ad 63 e6 54 e6 c9 ca 77 76 6d a1

Exponent (24 bits):
65537

-Kendall
 
Last edited:
D

Deleted member 8382

Guest
I think RSA goes a bit further than what he needed... xD I understood he wanted a homemade encrypt, not the encryption used by the FBI xDD
 
Joined
Oct 19, 2009
Messages
27
Points
0
I think RSA goes a bit further than what he needed... xD I understood he wanted a homemade encrypt, not the encryption used by the FBI xDD

yes, it would be engouf, as a selfmade code ;)

and it would confuse "normal" people, so that they give up thinken on the idee, stealing code from somebody or others ;)

rg
 
Joined
May 25, 2008
Messages
158
Points
18
RSA is a public key algorithm, which could be quite confusing for someone just getting started.

A really basic (but powerful) crypto algorithm that you can _easily_write yourself is a one time pad.

If you're not already familiar with bitwise operators such as AND, OR, NOT, XOR, then look them up. You're interested in XOR because it's reversible.

What you want to do is XOR each character of the plaintext with the corresponding character of the key. The result is the ciphertext. To recover the plaintext, XOR each character of the ciphertext with the key.

This algorithm is _unbreakable_ in theory, provided that the length of the key equals the length of the data (and you never use the same key more than once). This is not terribly useful in practice, so you can loop over the key and/or hash it to make it more practical (but much less secure).

This is a great little project for a newbie to programming, because it's very easy to do yourself, however it also demonstrates one of the key principles used in all the big name algorithms. DES and AES both use this principle, however they are block ciphers (not stream ciphers like this)... and they also have a lot of other fancy tricks and math involved.

If you need any help drop me a PM.
 
Last edited:

lazer

0
Joined
Dec 21, 2008
Messages
361
Points
0
RSA is a public key algorithm, which could be quite confusing for someone just getting started.

A really basic (but powerful) crypto algorithm that you can _easily_write yourself is a one time pad.

If you're not already familiar with bitwise operators such as AND, OR, NOT, XOR, then look them up. You're interested in XOR because it's reversible.

What you want to do is XOR each character of the plaintext with the corresponding character of the key. The result is the ciphertext. To recover the plaintext, XOR each character of the ciphertext with the key.

This algorithm is _unbreakable_ in theory, provided that the length of the key equals the length of the data (and you never use the same key more than once). This is not terribly useful in practice, so you can loop over the key and/or hash it to make it more practical (but much less secure).

This is a great little project for a newbie to programming, because it's very easy to do yourself, however it also demonstrates one of the key principles used in all the big name algorithms. DES and AES both use this principle, however they are block ciphers (not stream ciphers like this)... and they also have a lot of other fancy tricks and math involved.

If you need any help drop me a PM.


Great! Thanks! :) Thats what I was looking for. I am new to programming and still dont understand that 128 bit encryption yet. I can code and decode things on paper using shift, stretch and matrices but I cant code that stuff into an actual program. I will do some research on XOR and be dropping you some pms in the next few days.
 




Top