The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
(40gs & 40G) Hill's Encryption System
04-25-2018, 10:08 AM
Post: #1
(40gs & 40G) Hill's Encryption System
The following four programmes implement Hill's Cypher system for the HP 40gs & 40G.

HILLSET stores the parameters, encyphering & decyphering matrices & additional cypher vector in M9, M0 & M8.
The programme asks for an encyphering modulus, for English perhaps 26, & size of cyphering matrices & vector, conveniently 4 to fit on the screen.

ENCY encyphers the conformable matrix M1 & stores the result in M1.

DECY decyphers the conformable matrix M1 & stores the result in M1.

M1ADDV8 adds/subtracts the comformable vector M8 to the rows of M1.

For info on Hill's system see:

https://en.wikipedia.org/wiki/Hill_cypher

HILLSET

Code:
INPUT R;"Hill Cryptosystem"; "Random";" Enter Max Value ► R";26:
INPUT C;"Hill Cryptosystem"; "Modulus";" Cypher Modulus ► C";52:
MODSTO(C):
INPUT S;"Hill Cryptosystem"; "Size";" Size of Cypher Matrix ► S";4:
DO
EXPANDMOD(MAKEMAT(INT(R*RANDOM)*SIGN(RANDOM-.5),S,S))►M9:
IFERR
EXPANDMOD(XQ(M9)-1)►M0:
THEN
0:
ELSE
1:
END:
UNTIL
Ans
END:
EXPANDMOD(MAKEMAT(INT(R*RANDOM)*SIGN(.5-RANDOM),1,S))►M8:

ENCY

Code:
MULTMOD(M1,M9)►M1: 
1:
RUN M1ADDV8:

DECY

Code:
-1:
RUN M1ADDV8:
MULTMOD(M1,M0)►M1:

M1ADDV8

Code:
Ans►V:
SIZE(M1):
EXPANDMOD(MAKEMAT(M1(I,J)+V*M8(1,J),Ans(1),S))►M1:
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(40gs & 40G) Hill's Encryption System - Gerald H - 04-25-2018 10:08 AM



User(s) browsing this thread: 1 Guest(s)