comp.lang.ada
 help / color / mirror / Atom feed
* Tasking and Concurrent Programming Using Multiple Ada Programs.
@ 2017-04-29  8:13 Austin Obyrne
  2017-04-29 13:55 ` Dennis Lee Bieber
  2017-04-29 13:56 ` Simon Wright
  0 siblings, 2 replies; 6+ messages in thread
From: Austin Obyrne @ 2017-04-29  8:13 UTC (permalink / raw)


I have come over from sci crypt group to ask your advice on an encryption concept.  The concept is a design  plan to use a possible 36 ciphers (variants of the same basic cipoher and compatible to each other)in an Ada tasking program. 

The hoped for plan is to write a program that will cater for 36 (or less if needs be ) ciphers all reading in and immediately encrypting, in rotation from the same file of plaintext and writing out the resulting ciphertext to the same ciphertext file (the encrypted plaintext file).  They would of course be written in Ada.

What I would like to know is if some of your members are familiar with tasking and concurrent programming sufficient to be able to say - Yes, it is feasible at least and give any other advice you may have to offer.

Thanking you in anticipation of your usual support.

adacrypt
 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Tasking and Concurrent Programming Using Multiple Ada Programs.
  2017-04-29  8:13 Tasking and Concurrent Programming Using Multiple Ada Programs Austin Obyrne
@ 2017-04-29 13:55 ` Dennis Lee Bieber
  2017-04-29 14:08   ` Dennis Lee Bieber
  2017-04-29 13:56 ` Simon Wright
  1 sibling, 1 reply; 6+ messages in thread
From: Dennis Lee Bieber @ 2017-04-29 13:55 UTC (permalink / raw)


On Sat, 29 Apr 2017 01:13:45 -0700 (PDT), Austin Obyrne
<austin.obyrne@hotmail.com> declaimed the following:

>The hoped for plan is to write a program that will cater for 36 (or less if needs be ) ciphers all reading in and immediately encrypting, in rotation from the same file of plaintext and writing out the resulting ciphertext to the same ciphertext file (the encrypted plaintext file).  They would of course be written in Ada.
>

	Insufficient problem description...

	Do you mean that each of the 36 is processing the identical input, and
the output is to be interleaved in the destination file? If so, what chunk
size, and is the order of interleaving important (if it is, you probably
won't gain too much from concurrency since your output needs to be
sequential -- so you end up waiting for #1 to return data before you can
even go on to waiting for #2's data, even if #2 finishes before #1.

	It also means your output file will be 36 times larger... And then you
have the decryption -- what are you going to do, feed each chunk, in order,
to separate decryption functions when all of them are going to produce the
identical plain-text... Lots of redundant processing on your end, while
supplying an attacker with 36 variant copies of the same text -- if they
can determine the chunk size (and depending upon algorithms, the encrypted
text may show some boundaries).

	OR is each of the 36 supposed to be working on a different chunk of the
source -- so the output file is the same size as the input? You've still
got the problem of having to produce the output in sequential order, so
there is lots of waiting for output to be available.

>What I would like to know is if some of your members are familiar with tasking and concurrent programming sufficient to be able to say - Yes, it is feasible at least and give any other advice you may have to offer.
>

	Sure it's possible... But is it effective and useful? Probably not.

{NOTE: I used the above text as the "plain.txt"}

	Python program (you didn't think I was going to write your Ada
template, did you?):

-=-=-=-=-=-

import threading
import Queue

CHUNKSIZE = 32

class Algorithm1(object):
    def __init__(self, increment):
        self.inc = increment
    def process(self, pbyte):
        return chr((ord(pbyte) + self.inc) % 256)

class Algorithm2(object):
    def __init__(self, increment):
        self.inc = increment
    def process(self, pbyte):
        if self.inc == 0: self.inc = 1
        cbyte = chr((ord(pbyte) + self.inc) % 256)
        self.inc = (self.inc * 2) % 256
        return cbyte

class EOD(object):
    pass

ALGORITHMS = [ Algorithm1(2), Algorithm2(2), Algorithm1(3), Algorithm2(3) ]

def process(alg, inQ, outQ):
    while True:
        data = inQ.get()
        if data == EOD:
            break
        else:
            odata = "".join([alg.process(d) for d in data])
            outQ.put(odata)

taskControl = []

for alg in ALGORITHMS:
    inQue = Queue.Queue()
    outQue = Queue.Queue()
    task = threading.Thread(target=process, args=(alg, inQue, outQue))
    task.start()
    taskControl.append( (task, inQue, outQue) )

fin = open("plain.txt", "rb")
fout = open("cypher.txt", "wb")

while True:
    data = fin.read(CHUNKSIZE)
##    print repr(data)
    if not data: break
    #   send CHUNKSIZE of data to each task to process
    for (t, iQ, oQ) in taskControl:
        iQ.put(data)

    #   wait for each task in sequence to return the processed chunk
    for (t, iQ, oQ) in taskControl:
        odata = oQ.get()
##        print repr(t), repr(odata)
        fout.write(odata)

#   send END OF DATA flag to each task
for (t, iQ, oQ) in taskControl:
    iQ.put(EOD)

#   join (termination) of tasks
for (t, iQ, oQ) in taskControl:
    t.join()

fout.close()
fin.close()
-=-=-=-=-=-=-

	And the output of running it (note -- the newsreader will likely have a
fit, though I'm copying from a text editor that shows non-printables as
inverse video expressions...

-=-=-=-=-=-=-
Qp"Ucv."4;"Crt"4239"23<35<67"/29Qr(c´¬!4=(Q² 325?0Pqº25><E@m°8Rq#Vdw/#5<#Dsu#534:#34=46=78#03:Rt,k‘Ôì 3;$I€’`²13;(@Qz±4<8=0Mp·22"*RFV+."Cwuvkp"Qd{tpg">cwuvkp024(8p„Ô*.$I…“´éo"Sj‰’®å!>e}ƒ”©î/33#+SGW,/#Dxvwlq#Re|uqh#?dxvwlq112$0`d”©-"E}ƒ”©î!Qf‚Ž¥ =cy{„‰®®qd{tpgBjqvockn0eqo@"fgenckogf"vjqf‚Ž¥Àiqxuq‰¬®dqqF0„¥ãmcmuu„`ôire|uqhCkrwpdl
o1frpA#ghfodlphg#wkpd}z~…€èpvqiyŒnãpoB(t…£ìbkqmt@´èg"hqnnqykpi<\x0f\f\x0f\f@Vjg"jqrgf"hqt"rg$n\x7fŒ¬ïxkroJ-J\v@Xpu@¨ïqgh(v² qh#iroorzlqj=\x10
\x10
AWkh#krshg#iru#sf"jw|Œ¯÷jpkB\x1d*MŠ?Vlm0ˆ¯ðff$n\x7f’`ðncp"ku"vq"ytkvg"c"rtqitco"vjcv"ynev0‰³ uq$\x7f‚‰´å!c$x‚§òbo$|x´ xodq#lv#wr#zulwh#d#surjudp#wkdw#zmcr(y“`ôp"{zy”¥ b"tz\x7f‡²án"xpq”`÷knn"ecvgt"hqt"58"*qt"nguu"kh"pggkpt0ƒ¡ôft$n\x7f’`³7",w‚@¬åtu$qv@®åfloo#fdwhu#iru#69#+ru#ohvv#li#qhhjnp(s´ås"jw‚@s¶!*sz0Œ¥ót"mn0Ž¥åfu"dg"+"ekrjgtu"cnn"tgcfkpi"k
p"cfw(r…`©!emxx…²ó!cpt0’¥áekro0‰® bgv#eh#,#flskhuv#doo#uhdglqj#lq#deu$ju@i dktpu’³ bnp(‚…¡äjpk(yŽ`ápf"koogfkcvgn{"gpet{rvkpi."kp"tqph(y­åeke|uŒ¹ fpgz‰´éoi0(yŽ`òpqg#lpphgldwho|#hqfu|swlqj/#lq#urof$q}¥äjcxm|™`åoev€”©îh.$q~@²ïvcvkqp"htqo"vjg"ucog"hkng"qh"rncve|y® gtsu0”¨å!ueuu@¦émg$wv@°ìbwdwlrq#iurp#wkh#vdph#iloh#ri#soducxq\x7fŽ`æsq
q(„ˆ¥ tcqm0†©ìf"sn0¬ákpvgzv"cpf"ytkvkpi"qwv"vjg"tguwnkr|u˜´ bph(‡’©ôjpk(\x7f•´ uji(‚…³õmlqwh{w#dqg#zulwlqj#rxw#wkh#uhvxojpxmˆ”`áof$\x7f‚‰´éoi$w…”`ôig$zu“µìvkpi"ekrjgtvgzv"vq"vjg"ucog"ekrjvmvw@£éqjiz„…¸ô!vs(„ˆ¥ tcqm0ƒ©ðiwlqj#flskhuwh{w#wr#wkh#vdph#flskukro0ƒ©ðigv|u˜´ uq$|x…`óboi(s‰°ègtvgzv"hkng"*vjg"gpet{rvgf"rnckpgv|u˜´ gkpm0H´èf"ivs’¹
ðugh(€Œ¡éohuwh{w#iloh#+wkh#hqfu|swhg#sodlqftxmˆ”`æjni(8”¨å!grk‚™°ôff$x|©îvgzv"hkng+0""Vjg{"yqwnf"qh"eqwtuvi€„@¦émg-60@”èf{$\x7f\x7f•¬ä!qj(sµòtwh{w#iloh,1##Wkh|#zrxog#ri#frxuvug||0†©ìf+2(0t¨åz"{w…Œ¤ ph$k\x7f•²óg"dg"ytkvvgp"kp"Cfc0\x0f\f@\x0f\f\x0f\f\vKpuwg$ju@·òjvxm~@©î!Chi>-J¾\x0e\f\x11\x12\x19i®óvh#eh#zulwwhq#lq#Dgd1\x10
A\x10
\x10
\fLqvxf"fm0—²éuviv0‰® Bfe6\x1d*~\v\x0f\x0e\x11YŽ³õhhkekgpv"rtqdngo"fguetkrvkqp000\x0fhjqs‰¥îu"tz\x7f‚¬ån"hmƒƒ²éqvmw~Nn®\x0eiilflhqw#sureohp#ghvfulswlrq111\x10ghmky…®ô!rvwrŒ¥í!fi{s’©ðuksv>Nn\f\x0f\f\vFq"{qw"ogcp"vjcv"gcej"qh"vjg\f\x11\x12\x19d¯ zqy(}…¡î!vli„@¥ádj$wv@´èf
\x10
\fGr#|rx#phdq#wkdw#hdfk#ri#wkh\v\x0f\x0e\x11T`ùpw$uu® uje|0…¡ãi"sn0”¨å"58"ku"rtqeguukpi"vjg"kfgpvkecn""7>0‰³ qtsku“³éoi$|x…`éegr|yƒ¡ì!#69#lv#surfhvvlqj#wkh#lghqwlfdo#!5:(y“`ðsqgmƒ“©îh"xpu@©äfpxqs¬ kprwv."cpf"vjg"qwvrwv"ku"vq"dg"kkrx…”l bph(„ˆ¥ pwxx…”`ét"xw0‚¥ jlqsxw/#dqg#wkh#rxwsxw#lv#wr#eh#ljpt}„L`áof$|x…`ïvvt}„@©ó!vs(r…`épvgtngcxgf"kp"vj
g"fguvkpcvkqp"hkpxm‚Œ¥áwgh(yŽ`ôig$lu“´éocxq\x7fŽ`æjqwhuohdyhg#lq#wkh#ghvwlqdwlrq#iloviz|…¡öff$q~@´èf"hmƒ”©îbvmw~@¦éngA"Kh"uq."yjcv"ejwpm"uk|g."cpf"niG0i¦ tq0(‡ˆ¡ô!el}~‹`ój|i40®ä!ohB#Li#vr/#zkdw#fkxqn#vl}h/#dqg#mgC(Y†`óp.$\x7fx´ djyv{@³é{g0(qŽ¤ ku"vjg"qtfgt"qh"kpvgtngcxkpi"korkw(„ˆ¥ pthm‚@¯æ!kr|u’¬åbxmvw@©íqlv#wkh#rughu#ri#lqwhuohdylqj#
lpsju$|x…`ïsfiz0¦ jpxm‚Œ¥áwkro0‰­ðqtvcpv"*kh"kv"ku."{qw"rtqdcdn{"yqv|qŽ´ )kj(y”`ét.$\x7f•`ðsqfirŒ¹ xruwdqw#+li#lw#lv/#|rx#suredeo|#zptxi~”`¨jh$q„@©ó-"}w…@°òpdej|™`÷qp)v"ickp"vqq"owej"htqo"eqpewttgqr/„@§ájp$|\x7f`ível(v’¯í!esvs•²òfrq*w#jdlq#wrr#pxfk#iurp#frqfxuuhpp+|0‡¡éo"xw\x7f@­õdj$n‚­ dqrk…’²åpe{"ukpeg"{qwt"qwvrwv"pggfu"vq"dpg0“©îdg
$\x7f•² pwxx…”`îfgh{0”¯ cqf|#vlqfh#|rxu#rxwsxw#qhhgv#wr#eoe}(ƒ‰®ãf"}w…’`ïvvt}„@®åffw(„`âg"ugswgpvkcn"//"uq"{qw"gpf"wr"ycg${u‘µåovmi|@m­!us(‰µ fph(…`÷bh#vhtxhqwldo#00#vr#|rx#hqg#xs#zdf"wm•¥îuket0Mm tq$\x7f•`åof$}€@·ákvkpi"hqt"%3"vq"tgvwtp"fcvc"dghqkxq~‡`æpt$+A@´ï!ti|…’® ecxi0‚¥æplwlqj#iru#&4#wr#uhwxuq#gdwd#ehirjvmvw@¦ïs"'90”¯ sgx}‚Ž
`äbve(r…¦ïtg"{qw"ecp"gxgp"iq"qp"vq"yckvkpiti(‰µ dcr(u–¥î!is(\x7fŽ`ôp"{iy”©îhuh#|rx#fdq#hyhq#jr#rq#wr#zdlwlqjsg$\x7f•`ãbp$m†…® hq$w~@´ï!yeq„‰®ç"hqt"%4)u"fcvc."gxgp"kh"%4"hkpku"jw‚@c²(u$lq”¡¬!gzm~@©æ!%6(v‰®ét#iru#&5*v#gdwd/#hyhq#li#&5#ilqlv!hsz0Cr§t"hi„l fxiv0‰¦ $4$nyŽ©ójgu"dghqtg"%30\x0f\f\x0f\f\vKv"cnuq"ogcpuji{0‚¥æpti(3Qn\v\x0f\x0e\x11Y”`ámus(}…¡îtkhv
#ehiruh#&41\x10
\x10
\fLw#dovr#phdqvigw(r…¦ïsg$+ANMŠ\x0e\f
Q„@¡ìtq$uu®ó"{qwt"qwvrwv"hkng"yknn"dg"58"vko"}w…’`ïvvt}„@¦émg$\x7fyŒ¬ cg$;F@´én#|rxu#rxwsxw#iloh#zloo#eh#69#wlp!{s}‚@¯õury|0†©ìf"{q|Œ`âf"7>0”©ígu"nctigt000"Cpf"vjgp"{qw"jcxg"vgw(|²çft26>@îe"xpuŽ`ùpw$pq–¥ uhv#odujhu111#Dqg#wkhq#|rx#kdyh#wfu$tq’§ås0260a®ä!vlm~@¹ïv"li†…`ôjg"fget{rvkqp"//"yjcv"ctg"{qw"iqji(t…£òzrxq\x7fŽ`­."{pq”`ásg$\x7f•`çp
kh#ghfu|swlrq#00#zkdw#duh#|rx#jrig$luƒ²ùqvmw~@m­!yli„@¡òf"}w…@§ïkpi"vq"fq."hggf"gcej"ejwpm."kp"qkro0”¯ eq0(v…¥ä!gekx@£èvpo40‰® plqj#wr#gr/#ihhg#hdfk#fkxqn/#lq#rjpk(„`äp.$nu…¤ fcgp0ƒ¨õom0(yŽ`ïtfgt."vq"ugrctcvg"fget{vkqp"hwpethm‚L`ôp"wm€²áug$luƒ²ùuksv0†µîdughu/#wr#vhsdudwh#ghfu|wlrq#ixqfsfiz<@´ï!uixq’¡ôf"hms’¹ôjqr(v•®ãvkqpu"yjgp"cn
n"qh"vjgo"ctg"iqkpivmw~“`÷igr(qŒ¬ ph$|x…­ bti(w©îhwlrqv#zkhq#doo#ri#wkhp#duh#jrlqjuksvƒ@·èfp$i|Œ`ïg"xpu`ásg$o\x7f‰®ç"vq"rtqfweg"vjg"kfgpvkecn"rnckp/"xw0²ïewgm0”¨å!khm~”©ãbn$x|©î.#wr#surgxfh#wkh#lghqwlfdo#sodlq0!vs(€’¯ävei(„ˆ¥ jfiv„‰£ám"ttq‰®­vgzv000"Nqvu"qh"tgfwpfcpv"rtqeguvi€„Nn®!Ns|ƒ@¯æ!til…Ž¤áov$x‚£åtwh{w111#Orwv#ri#uhgxqgdqw
#surfhvug||>Nn Mqx{0¦ sgh}~„¡îu"tz\x7fƒ¥óukpi"qp"{qwt"gpf."yjkng"uwrrn{kpumvw@¯î!{s}‚@¥îe.$\x7fx‰¬å!uyx€Œ¹éovlqj#rq#|rxu#hqg/#zkloh#vxsso|lqtkro0® zqyz0…®ä-"{pyŒ¥ twtx|™©îi"cp"cvvcemgt"ykvj"58"xctkcpv"eqi$i~@¡ôucgsu’`÷jvl(CV`öbtmi~”`ãpj#dq#dwwdfnhu#zlwk#69#yduldqw#frh"ev0´ôbeom‚@·éuj$;F@¶áskev„@£ïrkgu"qh"vjg"ucog"vgzv"//"kh"vjg{rmmƒ@¯
æ!vlm0“¡íf"xmˆ”`­."mn0”¨åzslhv#ri#wkh#vdph#wh{w#00#li#wkh|qki{0¦ uji(ƒ­å!vi€„@m­!kj(„ˆ¥ù"ecp"fgvgtokpg"vjg"ejwpem"uk|g"*"gi~@¤åugvuyŽ¥ uji(sˆµîdm${yš¥ )#fdq#ghwhuplqh#wkh#fkxqfn#vl}h#+!eev0„¥ôftqq~…`ôig$kx•®ãl"wqŠ…`¨cpf"fgrgpfkpi"wrqp"cniqtkvjou."vcrl0„¥ðfphq~‡`õqqr(qŒ§ïskxp}“l udqg#ghshqglqj#xsrq#dojrulwkpv/#wbph(t…°åofmvw@µðpp$
i|‡¯òjvluƒL`ôjg"gpet{rvgf"vgzv"oc{"ujqy"uqog"ji(uŽ£òzrxmt@´åyv$uq™`óiq{(ƒ­å!kh#hqfu|swhg#wh{w#pd|#vkrz#vrph#ig$m~ƒ²ùqvil0”¥øu"qi‰@³èpy${\x7f¥ dqwpfctkgu+0\x0f\f\x0f\f\vQT"ku"gcej"qh"vds}~„¡òjgw1>-J\v\vSZ0‰³ fcgp0¦ uerxqgdulhv,1\x10
\x10
\fRU#lv#hdfk#ri#wcqyvt²éfu-6\x1d*MŠ
QV(y“`åbel(\x7f†`ôjg"58"uwrrqugf"vq"dg"yqtmkpi"qp"ji(CV`óvrtwƒ…¤ uq$ju@·ïsmmvw@¯î!kh#69#vxssrvhg#wr#eh#zrunlqj#rq#ig$;F@³õqrs{u„`ôp"fm0—¯òlkro0® c"fkhhgtgpv"ejwpm"qh"vjg"uqwteg"c$ly†¦åsgr|0ƒ¨õom$wv@´èf"ww…’£å!d#gliihuhqw#fkxqn#ri#wkh#vrxufh#b"hqv†¥òfpx(sˆµîl"sn0”¨å!us}‚ƒ¥ //"uq"vjg"qwvrwv"hkng"ku"vjg"uco/1(ƒ`ôig$w…”°õu"jq|…`ét"xpu@³
án00#vr#wkh#rxwsxw#iloh#lv#wkh#vdp./${\x7f@´èf"s}„µô!hmtu@©ó!vlm0“¡íg"uk|g"cu"vjg"kprwvA"[qw)xg"uvkng${yš¥ bu$|x…`éory|O@™ïv)zm0“´émh#vl}h#dv#wkh#lqsxwB#\rx*yh#vwlof"wqŠ…`át"xpu@©îqwxG0y¯õ(xi(ƒ”©ìn"iqv"vjg"rtqdngo"qh"jcxkpi"vq"rn$o\x7f”`ôig$x‚¢ìfo$wv@¨áwkro0”¯ qo#jrw#wkh#sureohp#ri#kdylqj#wr#sm"kw„@´èf"tz\x7f‚¬ån"sn0ˆ¡öjpk(„`ðtqfweg"vjg"
qwvrwv"kp"ugswgpvkcn"tsl…ƒ¥ uji(\x7f•´ðvv$q~@³årwiv„‰¡ì!urgxfh#wkh#rxwsxw#lq#vhtxhqwldo#sqh}s…`ôig$w…”°õu"mv0“¥ñvgr|y¬ qtfgt."uq"vjgtg"ku"nqvu"qh"yckvkqvlu’l tq$|x…²å!kw(|´ó!qj(‡©ôjrughu/#vr#wkhuh#lv#orwv#ri#zdlwlpthm‚L`óp"xpu’¥ ju$t\x7f”³ ph$\x7fq‰´épi"hqt"qwvrwv"vq"dg"cxckncdng0\x0f\fpk(v² pwxx…”`ôp"fm0¶ájnej|…n\vqj#iru#rxwsxw#wr#eh#dyd
lodeoh1\x10
oi$n\x7f’`ïvvt}„@´ï!di(q–¡émcftuNMŠ\x0f\f@Yjcv"K"yqwnf"nkmg"vq"mpqy"ku"\x0f\x0eFgˆ¡ô!K$\x7f\x7f•¬ä!nmsu@´ï!mrw‡@©ó!\x10
AZkdw#L#zrxog#olnh#wr#nqrz#lv#\x0e\fB_x´ J"{w…Œ¤ mkom0”¯ lps\x7f0‰³ kh"uqog"qh"{qwt"ogodgtu"ctg"hcokkj(ƒ­å!qj(‰µò!oiur…²ó!cvm0†¡íjli#vrph#ri#|rxu#phpehuv#duh#idpljh${\x7f¥ ph$\x7f•² ngqju’³ bti(v­énkct"ykvj"vcumkpi"cpf"eqpewttgpvnmi‚@·éuj$|q“«éoi$i~„`ãppg}‚’¥îuoldu#zlwk#wdvnlqj#dqg#frqfxuuhqwmkez0—©ôi"xiƒ‹©îh"evt@£ïoeyz‚…®ô"rtqitcookpi"uw
hhkekgpv"vq"dg"cd"tz\x7f‡²ánomvw@³õghmky…®ô!vs(r…`ác#surjudpplqj#vxiilflhqw#wr#eh#de!rvww’¡ínkro0“µægkgquŽ´ uq$ju@¡âng"vq"uc{"/"[gu."kv"ku"hgcukdng"ni(„`ób{$50y¥ó-"m|0‰³ gge{y‚¬å!oh#wr#vd|#0#\hv/#lw#lv#ihdvleoh#mg$|\x7f@³áz"1(i…³¬!kx(y“`æfcwqrŒ¥ cv"ngcuv"cpf"ikxg"cp{"qvjgt"cfxkcx(|…¡óu"evt@§éwg$i~™`ïujiz0¤öjdw#ohdvw#dqg#jlyh#dq|#rwkhu#
dgylbv$tu³ô!crl0‡©öf"ev‰@¯ôigv(q„¶éeg"{qw"oc{"jcxg"vq"qhhgt0\x0f\f@\x0f\f\x0f\fei(‰µ nc}(x¶å!vs(\x7f†¦ås0\x11\x12N-J\vfh#|rx#pd|#kdyh#wr#riihu1\x10
A\x10
\x10
dg$\x7f•`íb{$pq–¥ uq$wv†¥ò/\x0f\x0eF\x1d*MŠ\vUwtg"kv)u"rquukdng000"Dwv"ku"kv\vW}‚…`éu)w(€³ójdpm>Nn Cwx(y“`éu\fVxuh#lw*v#srvvleoh111#Exw#lv#lw
Uyzu@©ô(u$x\x7f“³écni6>N`Âvv$qƒ@©ô"ghhgevkxg"cpf"wughwnA"Rtqdcdn{""inv…£ôjxi(qŽ¤ vuin…Œ\x7f Qtsjq‚¬ù!#hiihfwlyh#dqg#xvhixoB#Suredeo|#!gjnuƒ´éwg$i~„`õtgj}|_`ÐsqfirŒ¹ pqv0ps|>qrw1oqx6
-=-=-=-=-=-


-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Tasking and Concurrent Programming Using Multiple Ada Programs.
  2017-04-29  8:13 Tasking and Concurrent Programming Using Multiple Ada Programs Austin Obyrne
  2017-04-29 13:55 ` Dennis Lee Bieber
@ 2017-04-29 13:56 ` Simon Wright
  2017-04-29 16:08   ` Austin Obyrne
  1 sibling, 1 reply; 6+ messages in thread
From: Simon Wright @ 2017-04-29 13:56 UTC (permalink / raw)


Austin Obyrne <austin.obyrne@hotmail.com> writes:

> I have come over from sci crypt group to ask your advice on an
> encryption concept.  The concept is a design plan to use a possible 36
> ciphers (variants of the same basic cipoher and compatible to each
> other)in an Ada tasking program.
>
> The hoped for plan is to write a program that will cater for 36 (or
> less if needs be ) ciphers all reading in and immediately encrypting,
> in rotation from the same file of plaintext and writing out the
> resulting ciphertext to the same ciphertext file (the encrypted
> plaintext file).  They would of course be written in Ada.

I dont know why you want to do this, but - if you want to get a speed-up
- you won't. The problem isn't so much the reading of each successive
plaintext character and sending it to the encrypting task; the problem
is that the part of the program that writes the output must successively
wait for each of the encrypting tasks to provide its latest output
before writing it to the output medium. So the whole process is bounded
by the output.

On the other hand, the effect of using tasks would be that each task
would see only every Nth character, so perhaps this is actually your
intent. If I was doing this I would look into using an abstract data
type (say, Encryption_State) to encapsulate the state needed to encrypt
the next character; arrange a procedure

   procedure Encrypt (State : in out Encryption_State;
                      Plain : Plain_Text_Character;
                      Result : out Encrypted_Text_Character);


and then arrange

   type State_Index is mod 36;
   States : array (State_Index) of Encryption_State;

so that as you pick the next input character you cycle round States to
pick the state to encrypt it with.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Tasking and Concurrent Programming Using Multiple Ada Programs.
  2017-04-29 13:55 ` Dennis Lee Bieber
@ 2017-04-29 14:08   ` Dennis Lee Bieber
  0 siblings, 0 replies; 6+ messages in thread
From: Dennis Lee Bieber @ 2017-04-29 14:08 UTC (permalink / raw)


On Sat, 29 Apr 2017 09:55:28 -0400, Dennis Lee Bieber
<wlfraed@ix.netcom.com> declaimed the following:


>	And the output of running it (note -- the newsreader will likely have a
>fit, though I'm copying from a text editor that shows non-printables as
>inverse video expressions...
>
	It did too -- had an alert that some characters were replaced with ? as
they didn't fit any of the available MIME encodings (which should have been
none <G>)

	If it helps, the first and last chunks as shown by the debug print
statements...

'On Sat, 29 Apr 2017 01:13:45 -07'
<Thread(Thread-1, started 14036)> 'Qp"Ucv."4;"Crt"4239"23<35<67"/29'
<Thread(Thread-2, started 5776)>
'Qr(c\x81\xb4\xac!4=(Q\x90\xb2\xa0325?0Pq\xba25><E@m\xb08'
<Thread(Thread-3, started 9400)> 'Rq#Vdw/#5<#Dsu#534:#34=46=78#03:'
<Thread(Thread-4, started 8076)>
'Rt,k\x91\xd4\xec\xa03;$I\x80\x92`\xb213;(@Qz\xb14<8=0Mp\xb7'
'00 (PDT), Austin Obyrne <austin.'
<Thread(Thread-1, started 14036)> '22"*RFV+."Cwuvkp"Qd{tpg">cwuvkp0'
<Thread(Thread-2, started 5776)>
'24(8p\x84\xd4*.$I\x85\x93\xb4\xe9o"Sj\x89\x92\xae\xe5!>e}\x83\x94\xa9\xee/'
<Thread(Thread-3, started 9400)> '33#+SGW,/#Dxvwlq#Re|uqh#?dxvwlq1'
<Thread(Thread-4, started 8076)>
'12$0`d\x94\xa9-"E}\x83\x94\xa9\xee!Qf\x81\x82\x8e\xa5\xa0=cy{\x84\x89\xae\xae'

' effective and useful? Probably '
<Thread(Thread-1, started 14036)> '"ghhgevkxg"cpf"wughwnA"Rtqdcdn{"'
<Thread(Thread-2, started 5776)>
'"inv\x85\xa3\xf4jxi(q\x8e\xa4\xa0vuin\x85\x8c\x7f\xa0Qtsjq\x82\xac\xf9!'
<Thread(Thread-3, started 9400)> '#hiihfwlyh#dqg#xvhixoB#Suredeo|#'
<Thread(Thread-4, started 8076)>
'!gjnu\x83\xb4\xe9wg$i~\x84`\xf5tgj}|_`\xd0sqfir\x8c\xb9\xa0'
'not.'
<Thread(Thread-1, started 14036)> 'pqv0'
<Thread(Thread-2, started 5776)> 'ps|>'
<Thread(Thread-3, started 9400)> 'qrw1'
<Thread(Thread-4, started 8076)> 'oqx6'
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Tasking and Concurrent Programming Using Multiple Ada Programs.
  2017-04-29 13:56 ` Simon Wright
@ 2017-04-29 16:08   ` Austin Obyrne
  2017-05-07 19:32     ` Robert Eachus
  0 siblings, 1 reply; 6+ messages in thread
From: Austin Obyrne @ 2017-04-29 16:08 UTC (permalink / raw)


On Saturday, April 29, 2017 at 2:56:37 PM UTC+1, Simon Wright wrote:
> Austin Obyrne <austin.obyrne@hotmail.com> writes:
> 
> > I have come over from sci crypt group to ask your advice on an
> > encryption concept.  The concept is a design plan to use a possible 36
> > ciphers (variants of the same basic cipoher and compatible to each
> > other)in an Ada tasking program.
> >
> > The hoped for plan is to write a program that will cater for 36 (or
> > less if needs be ) ciphers all reading in and immediately encrypting,
> > in rotation from the same file of plaintext and writing out the
> > resulting ciphertext to the same ciphertext file (the encrypted
> > plaintext file).  They would of course be written in Ada.
> 
> I dont know why you want to do this, but - if you want to get a speed-up
> - you won't. The problem isn't so much the reading of each successive
> plaintext character and sending it to the encrypting task; the problem
> is that the part of the program that writes the output must successively
> wait for each of the encrypting tasks to provide its latest output
> before writing it to the output medium. So the whole process is bounded
> by the output.
> 
> On the other hand, the effect of using tasks would be that each task
> would see only every Nth character, so perhaps this is actually your
> intent. If I was doing this I would look into using an abstract data
> type (say, Encryption_State) to encapsulate the state needed to encrypt
> the next character; arrange a procedure
> 
>    procedure Encrypt (State : in out Encryption_State;
>                       Plain : Plain_Text_Character;
>                       Result : out Encrypted_Text_Character);
> 
> 
> and then arrange
> 
>    type State_Index is mod 36;
>    States : array (State_Index) of Encryption_State;
> 
> so that as you pick the next input character you cycle round States to
> pick the state to encrypt it with.

Many , many thanks Simon.

I think the ciphertext bit of your advice will be OK.  Frankly I am not good enough to try out the Encrypt procedure.  what I am geting from you is tacit confirmation that the plan is at least feasible.

Speed of execution is not the target but the fact of each plaintext being encrypted by a different cipher is just unheard tactics todate and could be a new concept in cryptography.

Also, there are 36 factoorial permutations of key order that Alice might use and
exhaustive testing (Brute force per se) works out to about 1 million years (off the top of my head calculation.

The topic is fairly well covered in my Ada study book but I needed confirmation from you experts.

 A thousand thanks from me.

I will start experimenting when the remainder of the 36 variants is complete - done.

Austin O'Byrne


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Tasking and Concurrent Programming Using Multiple Ada Programs.
  2017-04-29 16:08   ` Austin Obyrne
@ 2017-05-07 19:32     ` Robert Eachus
  0 siblings, 0 replies; 6+ messages in thread
From: Robert Eachus @ 2017-05-07 19:32 UTC (permalink / raw)


On Saturday, April 29, 2017 at 12:08:57 PM UTC-4, Austin Obyrne wrote:

> I have come over from sci crypt group to ask your advice on an
> encryption concept...

Sigh!  See if you can get a copy of The Codebreakers by David Kahn from your library.  It was initially published in the 1960s, and there is a revised edition from 1997 that I haven't seen.   Of course, just about anything I did during my career is covered in one added chapter. There are other books I could recommend as introductions to cryptography, but none covering material more recent than WWII.  Modern cryptography, including public-key cryptography and FIPS standard algorithms are all very math intensive, mostly Number Theory.

The system you are attempting sounds like a variation on polyalphabetic substitution.  The US Government kept the "index of coincidence" a secret during WWII, and that was the major weakness of polyalphabetic systems.  Once you find the IC, you can solve the system as n more standard systems.  Most of the FIPS systems, such as AES, uses the previous state of the system as part of the key for the next (256) bits.

Oh, and don't try to implement AES in Ada, without some particular need.  It can be done, but most CPU chips today already have AES support built-in.

Rule one of cryptography: security by obscurity does not work.  If the system is not secure if your opponent knows how it works, it is not secure.  Rule two is that there is no point to making a system more secure than "practical cryptography," such as breaking and entering.  During WWII there were several naval engagements as part of practical cryptography to grab Naval Enigma machines and codebooks.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-05-07 19:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-29  8:13 Tasking and Concurrent Programming Using Multiple Ada Programs Austin Obyrne
2017-04-29 13:55 ` Dennis Lee Bieber
2017-04-29 14:08   ` Dennis Lee Bieber
2017-04-29 13:56 ` Simon Wright
2017-04-29 16:08   ` Austin Obyrne
2017-05-07 19:32     ` Robert Eachus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox