PC1 Encryption algorithm 80 bit keys for 6809 processor
(c) Alexander Pukall 1991-2004

The Org100 directory contains the source code and the hex code compiled at address $100
The Org8000 directory contains the source code and the hex code compiled at address $8000
The Org0 directory contains the source code and the hex code compiled at address $0

For all takes the start address : SD

You store the encryption/decryption key (80-bits = 10 bytes) at addresses :

SD+$0B
SD+$0C
SD+$0D
SD+$0E
SD+$0F
SD+$10
SD+$11
SD+$12
SD+$13
SD+$14

You call first the SD+$00 address to init the algorithm

For encryption :

Part 1:

You store the byte to encrypt at address SD+$09
You call the address SD+$03
You take the encrypted byte at address SD+$0A

You go to Part1: for all the bytes you wants to encrypt.

For decryption :

Part 2

You store the encrypted byt to decrypt at address SD+$0A
You call the address SD+$06
You take the decrypted byte at address SD+$0A

You go to Part2 : for all the bytes you wants to decrypt

Example :

SD=$8000

ENCRYPTION :

You store the encryption key $41 $72 $9A $6B $7C $8D $24 $8F $F4 $0F

$800B <- $41
$800C <- $72
$800D <- $9A
$800E <- $6B
$800F <- $7C
$8010 <- $8D
$8011 <- $24
$8012 <- $8F
$8013 <- $F4
$8014 <- $0F

To encrypt the bytes : $41 $42 $43 (you could encrypt 5000 bytes if you want)

You call one time $8000

You store :
$8009 <- $41
You call $8003
You take the encrypted byte at $800A, the result should be $AF

You store :
$8009 -< $42
You call $8003
You take the encrypted byte at $800A, the result should be $7C

You store :
$8009 <-$43
You call $8003
You take the encrypted byte at $800A, the result should be $9C

DECRYPTION :

You store the encryption key $41 $72 $9A $6B $7C $8D $24 $8F $F4 $0F

$800B <- $41
$800C <- $72
$800D <- $9A
$800E <- $6B
$800F <- $7C
$8010 <- $8D
$8011 <- $24
$8012 <- $8F
$8013 <- $F4
$8014 <- $0F

To decrypt the bytes : $AF $7C $9C

You call one time $8000

You store :
$8009 <- $AF
You call $8006
You take the decrypted byte at $800A, the result should be $41

You store :
$8009 -< $7C
You call $8006
You take the decrypted byte at $800A, the result should be $42

You store :
$8009 <-$9C
You call $8006
You take the decrypted byte at $800A, the result should be $43


