POV-Ray : Newsgroups : povray.text.scene-files : Vernam cipher Server Time
28 Mar 2024 09:45:15 EDT (-0400)
  Vernam cipher (Message 1 to 1 of 1)  
From: jr
Subject: Vernam cipher
Date: 1 Jun 2018 10:35:00
Message: <web.5b1158c121f9aee882a92ab90@news.povray.org>
hi,

'rxor.inc' is an implementation of a Vernam type cipher[a] in
a rotor-based machine, written in the SDL for POV version 3.7.

the cipher is "toy" in that it reads and writes data files with
comma-delimited text values, not binary.  it also expects arrays
which match in size the input string lengths.

the usage of the "API" is demonstrated in the included example
scenes 'rx-enc.pov' and 'rx-dec.pov'.

there's no documentation, but the 'rxor.inc' and the 'rx-*.pov'
files are commented.

in addition, 'rxor.inc' also includes a random generator macro
which has an output range of 0..255.  it requires the declaration
of a seed value >= 0 beforehand.  the use is straightforward, and
only documented here:

  #include "rxor.inc"
  #declare Seed = 12345;
  #for (I,0,99)
    #debug concat("N: ",str(rxor_rand(Seed),0,0),"\n")
  #end

all macro and declared names begin with a 'rxor_' prefix.

users of an *NIX like[b] OS can use the 'rxorincdata.tcl' script
to create new ciphers, adding one-time pad[c] capability.  :-)
this can be done by replacing lines 60 to 75 in (a copy of) the
include file with the script's output.

[a] https://en.wikipedia.org/wiki/Gilbert_Vernam
[b] requires urandom(4).
[c] https://en.wikipedia.org/wiki/One-time_pad

enjoy, jr.


Post a reply to this message


Attachments:
Download 'rxor-0.1.0.zip' (4 KB)

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.