Pascal Molin on Mon, 15 Nov 2021 13:38:27 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Cycle structure


Maybe you can use cyclic accessor :

get(v,i) = v[((i-1)%#v)+1]

--
Pascal

Le lun. 15 nov. 2021 à 13:28, Philippe de Rochambeau <phiroc@free.fr> a écrit :
Hello,
I’m trying to implement the Caesar Cypher Algorithm in PariBP (cf. https://cryptol.net/files/ProgrammingCryptol.pdf, p. 31).
I have created a variable called «  alphabet »  which contains uppercase characters from A to Z:

alphabet = Vecsmall("ABCDEFGHIJKLMNOPQRSTUVWXYZ »)

If I shift the characters in the vector by, say 3 characters, I get the following string: «  DEF… __ », which contains several blank spaces at the end.

Is there a way to convert a Vecsmall into a cycle structure, in PariGP, so that alphabet[26] = «  A » , ...?

Many thanks.

Cheers,

Philippe