Liberty BASIC Community Forum
« cryptografix »

Welcome Guest. Please Login or Register.
Oct 18th, 2017, 08:04am


Rules|Home|Help|Search|Recent Posts|Notification


« Previous Topic | Next Topic »
Pages: 1 2  Notify Send Topic Print
 hotthread  Author  Topic: cryptografix  (Read 260 times)
bluatigro
Guru
ImageImageImageImageImage


member is offline

Avatar

cxiu diversas el tio respondas cxiu samvaloras [ thats esperanto for : we are al different therefore we are al equal ]


PM

Gender: Male
Posts: 918
xx cryptografix
« Thread started on: Oct 4th, 2017, 07:28am »

i the futue there wil be a law in the netherlands
that gives the goverment the posebility
to catch every e-mail in a block of houses
an read the e-mail

i don't like that

so i wrote this :
Code:
'' bluatigro 4 okt 2017
'' cryptografix
a$ = "This is a test text to code / decode ."
print "text = " ; a$
b$ = code$( a$ , "qwertyuiop" )
print "code = " ; b$
c$ = code$( b$ , "qwertyuiop" )
print "decode = " ; c$
print "[ game over ]"
end
function code$( txt$ , key$ )
  uit$ = ""
  help$ = ""
  while len( txt$ ) > len( help$ )
    help$ = help$ + key$
  wend
  for i = 1 to len( txt$ )
    t = asc( mid$( txt$ , i , 1 ) )
    c = asc( mid$( help$ , i , 1 ) )
    uit$ = uit$ + chr$( t xor c )
  next i
  code$ = uit$
end function
 


how to use this in case of a untrusted target :

alice writes a text
alice sends her text coded whit key a to bob
bob codes the text whit key b
bob sends that to alice
alice decodes the text whit key a
alice sends the text to bob
bob decodes the text whit key b
bob reads text

are there ways to hack this ?
[ i m not absolutly sure about this ]
User IP Logged

basic's : C64 Simons C128 Amiga Amos quick4.5 Visual5 Visual6 Visual2005 Visual2008 just and last but not least liberty
Rod
Global Moderator
ImageImageImageImageImage


member is offline

Avatar

Graphics = goosebumps!


PM

Gender: Male
Posts: 5543
xx Re: cryptografix
« Reply #1 on: Oct 4th, 2017, 2:22pm »

Well a couple of things. The exchange of keys is the most crucial security point of a cypher. So emailing them seems kinda lame. Secondly if your government or security service is tasked with monitoring potential terrorist activity why would you stand in there way?

I have a working assumption that all of my online activity is monitored or moniterable. I have no desire to make myself a target for special monitoring or indeed to waste security folks time by decrypting my innocent cyphered messages.

Graphics and coding of any description is far far more fun than any cyphering.

User IP Logged

bluatigro
Guru
ImageImageImageImageImage


member is offline

Avatar

cxiu diversas el tio respondas cxiu samvaloras [ thats esperanto for : we are al different therefore we are al equal ]


PM

Gender: Male
Posts: 918
xx Re: cryptografix
« Reply #2 on: Oct 5th, 2017, 04:23am »

@ rod :
i partly agree

i don't think i need to use this
but there are things i don't want everybody to know

i have a diagnoses [ not albinism ]
that is not a accet on the labor market [ i have no job ]
or whit dating [ or wife ]
i m scared that if been known i wood not be taken seriosly .
in some places i have disclosed it
and they accepted it
the laborburo does not grant my wish
to develop my talent [ programming ]
so i learned al i know myself
whit some help from several fora and books

i like games , ai and graphics more then crypto too
it was also a coding exersise

WARNING :
if the hacker catches al 3 e-mail
the key's can be konwn
« Last Edit: Oct 5th, 2017, 04:40am by bluatigro » User IP Logged

basic's : C64 Simons C128 Amiga Amos quick4.5 Visual5 Visual6 Visual2005 Visual2008 just and last but not least liberty
Rod
Global Moderator
ImageImageImageImageImage


member is offline

Avatar

Graphics = goosebumps!


PM

Gender: Male
Posts: 5543
xx Re: cryptografix
« Reply #3 on: Oct 5th, 2017, 04:43am »

smiley well I have normal vision but I don't do very well with the ladies either!

Pity our society is not more tolerant, enjoy your programming.
User IP Logged

bluatigro
Guru
ImageImageImageImageImage


member is offline

Avatar

cxiu diversas el tio respondas cxiu samvaloras [ thats esperanto for : we are al different therefore we are al equal ]


PM

Gender: Male
Posts: 918
xx Re: cryptografix
« Reply #4 on: Oct 5th, 2017, 04:59am »

@ rod :
the tolerance is here more than other contry's
the LGHBT's are spoken about
we invented gaymariage
there is more knolige about our slave trading past
there is low tension between black and white

only there is a political partie whitch is anti islam

the problem i have is the last taboo
User IP Logged

basic's : C64 Simons C128 Amiga Amos quick4.5 Visual5 Visual6 Visual2005 Visual2008 just and last but not least liberty
CryptoMan
Senior Member
ImageImageImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 317
xx Re: cryptografix
« Reply #5 on: Oct 7th, 2017, 12:41pm »

Dear Blutriago

Please have a look at my post from 2010:

http://libertybasic.conforums.com/index.cgi?board=tips&action=display&num=1281881697

There is a solution for unbreakable key exchange method with RSA algorithm.

Write me if you need any clarifications.

SSL, TLS, HTTPS secure comms is based on RSA Key exchange.

Also, XOR method is easily breakable.

Look at the 3DES examples given at LB Encyclopedia Encryption tutorials.

And, if possible consider using AES256 algorithm.

However, first understand how RSA works. Easy to understand, hard to implement but I gave a LB example which illustrates it. Due to speed of LB try a not very high RSA key size. For real security you can use an external DLL built wit C++ for RSA Key sizes of 1024 bits and above.

However, concept can be illustrated even with an 64 bits RSA keys size which can be used to exchange a 128 bits 3DES key in two packets and use that key to encrypt your mail content.

Have a nice weekend.
User IP Logged

.....
CryptoMan
Senior Member
ImageImageImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 317
xx Re: cryptografix
« Reply #6 on: Oct 7th, 2017, 1:29pm »

Sorry Blue,

lbdownloads.com link seems to be down. So, you can not download the source code. Let me check my archives if I still have this piece of code.

Regards

CryptoMan
User IP Logged

.....
CryptoMan
Senior Member
ImageImageImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 317
xx Re: cryptografix
« Reply #7 on: Oct 7th, 2017, 3:21pm »

I tried to post the RSA Algorithm code as LB Encyclopedia as
Cryptography with Liberty BASIC: 103 Public Key Cryptography: RSA
as an Article Submission.

Format looks awful and I hope the admins can make it look better.

If they can do something then I can provide some introductory text on Public Key Cryptography with Liberty Basic.

Anyway, at least you can cut and paste the code from there. I think now visible at SUBMIT AN ARTICLE LINK and maybe soon at the ADVANCED TUTORIALS, ENCRYPTION SECTION.

You can have some basic information about RSA on http://www.geeksforgeeks.org/rsa-algorithm-cryptography/

User IP Logged

.....
CryptoMan
Senior Member
ImageImageImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 317
xx Re: cryptografix
« Reply #8 on: Oct 7th, 2017, 3:26pm »

Bluatigro I have sent you the RSA LB Source code with DM.

Regards
User IP Logged

.....
bluatigro
Guru
ImageImageImageImageImage


member is offline

Avatar

cxiu diversas el tio respondas cxiu samvaloras [ thats esperanto for : we are al different therefore we are al equal ]


PM

Gender: Male
Posts: 918
xx Re: cryptografix
« Reply #9 on: Oct 8th, 2017, 03:02am »

some time ago i write this
Code:
print "demonstration of the diffie hellman algoritm"
print "in reality g and p are mutch bigger"
print "is being used for encryption"
print "g and p cant be any random prime"
print "i dont know whit whitch g and p this does not work"
print
g = 5
print "prime 1 = [ g ] = " ; g
p = 7
print "prime 2 = [ p ] = " ; p
a = 3
print "secret number 1 = [ a ] = " ; a
aa = g ^ a mod p
print "g ^ a mod p = [ aa ] = " ; aa
b = 2
print "secret number 2 = [ b ] = " ; b
bb = g ^ b mod p
print "g ^ b mod p = [ bb ] = " ; bb
print
print "aa and bb are exchanged"
print
sa = bb ^ a mod p
print "bb ^ a mod p = " ; sa
sb = aa ^ b mod p
print "aa ^ b mod p = " ; sb

 
User IP Logged

basic's : C64 Simons C128 Amiga Amos quick4.5 Visual5 Visual6 Visual2005 Visual2008 just and last but not least liberty
Rod
Global Moderator
ImageImageImageImageImage


member is offline

Avatar

Graphics = goosebumps!


PM

Gender: Male
Posts: 5543
xx Re: cryptografix
« Reply #10 on: Oct 8th, 2017, 04:43am »

Onur, I have sorted out the code formatting and given the RSA code its own page. You might want to edit the introductory text. If you do want to edit the page I find it much easier to click on the edit icon then click on save and choose Wikitext editor. That way you get a plain text view of the page and I find it simpler to make changes that way.


« Last Edit: Oct 8th, 2017, 04:44am by Rod » User IP Logged

CryptoMan
Senior Member
ImageImageImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 317
xx Re: cryptografix
« Reply #11 on: Oct 8th, 2017, 07:07am »

Thanks Rod.

I will edit and put the content in.

Regards
User IP Logged

.....
CryptoMan
Senior Member
ImageImageImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 317
xx Re: cryptografix
« Reply #12 on: Oct 8th, 2017, 07:14am »

Thanks for the Diffie Helmann Key Exchange algorithm Bluatrigo.

It is precursor to RSA algorithm and in all of these Number Theoric algorithms you will need the Modular Arithmetic routines to handle very y large numbers of hundreds of digits.

Security of these algorithms depends on difficulty of factoring. When you have N = p x q = 15 it is easy to guess p=3 and q=5. The trick is to make this N so large that it is computationally unfeasible to determine the p and q because as soon as these are found the key is effectively broken.

User IP Logged

.....
CryptoMan
Senior Member
ImageImageImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 317
xx Re: cryptografix
« Reply #13 on: Oct 8th, 2017, 4:21pm »

I have written up the RSA Public Key cryptography article at LB Encyclopedia at this link:

http://lbpe.wikispaces.com/CryptographyWithLB103

I tried to write and format it to best of my ability but I can not say it is perfectly formatted.

Nevertheless, it should be quite understandable.

Maybe, Rod can change the upper level link as Public Key Cryptography instead of Classical Cryptography to this RSA tutorial.

It should be interesting to many who is not aware of Liberty Basic's hidden feature of huge integer arithmetic capability of hundreds of digits. This capability of LB allows this surprising capability to write RSA algorithm example like this.



User IP Logged

.....
bluatigro
Guru
ImageImageImageImageImage


member is offline

Avatar

cxiu diversas el tio respondas cxiu samvaloras [ thats esperanto for : we are al different therefore we are al equal ]


PM

Gender: Male
Posts: 918
xx Re: cryptografix
« Reply #14 on: Oct 9th, 2017, 04:19am »

we need a prime hunter
Code:
dim p( 1000 )
q = 2
p( 1 ) = 2
tel = 2
no = 0
while tel < 1000
  fl = 0
  i = 1
  while p( i ) <= sqr( q ) and fl = 0
    if q / p( i ) = int( q / p( i ) ) then
      fl = 1
      no = 1
    end if
    i = i + 1
  wend
  if fl = 0 then
    p( tel ) = q
    print q
    tel = tel + 1
  end if
  q = q + 1
wend
print "[ game over ]"

 


i use the agortm from the greek guy
but i check only primes

is there a faster way to hunt for primes ?
or to check if a number is prime ?
User IP Logged

basic's : C64 Simons C128 Amiga Amos quick4.5 Visual5 Visual6 Visual2005 Visual2008 just and last but not least liberty
Pages: 1 2  Notify Send Topic Print
« Previous Topic | Next Topic »

Rules|Home|Help|Search|Recent Posts|Notification

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls