what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

rc4.hp48

rc4.hp48
Posted Dec 21, 1999

rc4.hp48

tags | encryption
SHA-256 | 186995a3a6fbd9b8750b143df24f9bbb0b0975843b08ceab6fc2b4671ef15475

rc4.hp48

Change Mirror Download
From: cpunk@remail.ecafe.org (ECafe Anonymous Remailer)
Newsgroups: mail.cypherpunks
Subject: RC4 for HP48
Date: 23 Jan 96 02:23:03 GMT

-----BEGIN PGP SIGNED MESSAGE-----

Here is the RC4 cipher for the HP-48 calculator. It
complements the DES implementation by William E. Sommerfeld.
RC4 has a higher throughput than DES, but its key setup is
slower. The key may be up to 256 characters (2048 bits) --
the maximum supported by the RC4 algorithm.

Here are sample timings for a HP-48GX. The SX will be
correspondingly slower.
Key Setup (200 bits) 25.18 sec
RC4 throughput 5.06 cps
String to Array 61.83 cps
Array to String 56.12 cps

The HP-48 comes with a 2400 baud IR link and a
1200/2400/9600 baud RS232 port. The 48S, 48SX and 48G have
32Kb of RAM, almost none of which is used by the operating
system. The 48GX has 128Kb of RAM. With an entry price of
~100$ US, I feel that the HP-48 series would be a good choice
for a smart token. Possible uses are as digital cash wallets
and authentication tokens, not the mention simple encrypted
dumb terminals.

Installation:

If you have a serial cable, download the code below to
your HP and call it 'RC4'. This will create a directory
called 'RC4' with four programs in it. If you don't have a
cable you can type the whole thing in; it's not too large.
Store it as 'RC4' and again it will create a directory. Remember
not to type the "%%HP: T(3)A(D)F(.);" -- it's only needed for
a serial download.

Instructions:

These instructions assume that you are familiar with
stream-ciphers in general. If you are not, you might want to
get _Applied Cryptography_ by Bruce Schneier from your library
or book store.

Bit streams are represented as one dimensional arrays of
real numbers between 0 and 255. Yes, that's right, this
cipher uses floating-point! In User-RPL it's the fastest way.
To convert between strings and arrays use the commands S2A and
A2S.

S2A "String" -> [Array]
A2S [Array] -> "String"

To setup a key, use the SK command. It takes a
bitstream representing the keytext and returns the key
context. They keytext can be up to 256 bytes long.
Additional bytes will not be used. The key context is another
bitstream with 256 values in it. Because of time/memory
tradeoffs, a key context takes 2082 bytes of RAM to store. If
memory is tight, use A2S to compress the key context to a
string.

SK [Key text] -> [Key context]

To encrypt something use the RC4 command. The first
argument is the key context, the second is the plaintext or
ciphertext, both in bitstream form. It returns the updated
key context and the ciphertext or plaintext.

RC4 [Key context], [Plaintext] ->
[New key context], [Ciphertext]
or
RC4 [Key context], [Ciphertext] ->
[New key context], [Plaintext]

Enjoy
The Cunning Artificers

- -- CUT HERE --
%%HP: T(3)A(D)F(.);
DIR
SK
\<< DTAG OBJ\-> OBJ\-> DROP 0 255
FOR N N NEXT 259 258
PICK + 0 259 4 FOR N OVER
PICK N PICK + + 256 MOD DUP 255 - NEG N
4 - DUP2 IF \=/
THEN DUP2
IF >
THEN SWAP
END
DUP2 6 + ROLL SWAP 6 +
ROLL SWAP 4 ROLL 5 + ROLLD SWAP 3 +
ROLLD
ELSE
DROP2
END SWAP 1 - DUP
IF 260 <
THEN
DROP 258 PICK 259 +
END SWAP -1
STEP DROP2 0
0 258 \->ARRY OVER 2
+ ROLLD DROPN "Key"
\->TAG
\>>
RC4
\<< DTAG DUP SIZE OBJ\-> DROP 3 PICK
258 GET 4 PICK 257 GET 1 + 1 4 ROLL
FOR N 256 MOD 1 + DUP 5 PICK SWAP
GET 3 ROLL + 256 MOD 1 + DUP 5 ROLL
SWAP 4 PICK CSWP DUP DUP 5 PICK GET
OVER 5 PICK GET + 256 MOD 1 + GET 5
ROLL DUP N GET R\->B 3 ROLL R\->B XOR B\->R
N SWAP PUT 4 ROLL 4 ROLL 1 - SWAP
NEXT 4 ROLL 257 3 ROLL 1 - PUT
258 3 ROLL PUT "Updated key" \->TAG
SWAP "Result" \->TAG
\>>
S2A
\<< DUP SIZE
\<< \-> LEN
\<< 1 LEN
START DUP NUM SWAP TAIL
NEXT DROP LEN
\>>
\>> EVAL 1
\->LIST \->ARRY
\>>
A2S
\<< DTAG OBJ\-> OBJ\-> DROP "" SWAP 1
SWAP START SWAP CHR SWAP + NEXT
\>>
END
- -- CUT HERE --

- -----BEGIN PGP PUBLIC KEY BLOCK-----
Version: 2.6.2

mQCNAzEAEf4AAAEEAMONoLHj5CwKvaM6ch9GOcUjgoVS5sjXa4TzD2ohhtHFYR9l
QzNj0vNASBQKE/Mk9Flqg+dtitS7S7B0qZQ+mQmMT73yniun596jt1NCJ5sLBKrM
jDvYK3wGbycVX43RBiR3iwJZGq5blfWqNRE7kFdTxgu+bCdtLOFNVew9oBf9AAUR
tBZUaGUgQ3VubmluZyBBcnRpZmljZXJz
=pf3Y
- -----END PGP PUBLIC KEY BLOCK-----


-----BEGIN PGP SIGNATURE-----
Version: 2.6.2

iQCVAwUBMQRCWuFNVew9oBf9AQEPJgP/QzwxGIWU0sf+a8Vzj2tXtMqRhRQjG4Qp
Pcrwr76WhM/2KnHGNAdC3lKwyEK17cu32zbmPePhOvtdUNyV3L1KZlBioURK5Kxu
ZspnOLCmlKo8lbOa5mJl2bmV55W49B96ua+yxst1XaOzhfYDN/KjZsztGRnEbQx9
VovMpLXooLo=
=4pzv
-----END PGP SIGNATURE-----
Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    45 Files
  • 19
    Apr 19th
    8 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    11 Files
  • 23
    Apr 23rd
    68 Files
  • 24
    Apr 24th
    23 Files
  • 25
    Apr 25th
    16 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close