comp.lang.ada
 help / color / mirror / Atom feed
From: eachus@spectre.mitre.org (Robert I. Eachus)
Subject: Re: Bit manipulation facilities in Ada
Date: 1998/11/23
Date: 1998-11-23T00:00:00+00:00	[thread overview]
Message-ID: <EACHUS.98Nov23171551@spectre.mitre.org> (raw)
In-Reply-To: 36573C4D.DA431821@physics.purdue.edu

In article <36573C4D.DA431821@physics.purdue.edu> "Robert T. Sagris" <robs@physics.purdue.edu> writes:

 > I'm thinking about taking an Data Security and Encryption course.
 > The language for programming projects is open to the students.

 > I was wondering if any one could recommend any books that demonstrate
 > low level bit manipulation in Ada.

   I think that the problem is that bit manipulation is not low-level
in Ada, it is high level, but just as efficient.  For most modern
symmetric key algorithms that use Feistel networks you end up writing
one line of code that looks very much like the original definition:

   Block(1) := F(Block(2) xor Key(N)) xor Count;
   (Chosen to look real but not from any known algorithm. ;-)

  > None of which seem to cover this in any detail.

   Once you know that in Ada, Boolean operations are supported on
Booleans and arrays of Booleans, and in Ada 95 on unsigned integer
types, what more do you need to know.  (Other than in symmetric block
algorithms, you often want to declare the block type as an array of
sub-blocks, and the sub-blocks as unsigned or boolean arrays depending
on the algorithm.

  > The Professor has already recommended C for its built in Bit operators.
  > But I would like to try it in Ada, as I've never used in a class.
  > I could use the practice.

   The standard random number packages in Ada 95 will do fine for
testing algorithms, but if you really need cryptographic security, you
will need to collect your own random bits, and possibly use the
built-in PRNG for whitening.  Whitening is the process of taking
possibly biased (non-pseudo) random data and converting it into fewer,
but unbiased random bits.

   There is one other thing you may need.  In public key encryption,
you often need a way to do arithmetic on very large integer types.
Most Ada compilers supply such a package, as they need it internally,
but you may need to add X to the power Y mod Z as a primitive to get
any reasonable performance.

   The best choice is to use a cryptographic bignum package and create
a (high-level) interface to it.
--

					Robert I. Eachus

with Standard_Disclaimer;
use  Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...




  parent reply	other threads:[~1998-11-23  0:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-11-21  0:00 Bit manipulation facilities in Ada Robert T. Sagris
1998-11-21  0:00 ` Srinivasan, R
1998-11-22  0:00   ` dewarr
1998-11-22  0:00     ` Simon Wright
1998-11-23  0:00       ` dewarr
1998-11-24  0:00         ` P.S. Norby
1998-11-23  0:00     ` Marin David Condic
1998-11-24  0:00     ` Ole-Hjalmar Kristensen
1998-11-24  0:00       ` John McCabe
1998-11-22  0:00 ` The Ludwig Family
1998-11-23  0:00   ` dennison
1998-11-22  0:00 ` Robert T. Sagris
1998-11-22  0:00 ` Matthew Heaney
1998-11-22  0:00   ` dewarr
1998-11-23  0:00 ` Robert I. Eachus [this message]
1998-11-24  0:00 ` Stephen Leake
replies disabled

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