← RoseCode

ROSECODE 282

Caesarian shift

sinan · Crypto ·

You need to decode the following string:
yparjcfwnixigfwzt

Here's the pseudo code to get this encoded string:


function encode(string, n=29101923, offset=10^9)
begin
	len=length of string
	let array be an array with offset+len elements
	for i=1 to n
	begin
		array[i]=1
	end
	for i=n+1 to offset+len
	begin
		array[i]=sum of previous n elements
	end
	for i=1 to len
	begin
		encoded_string[i]=string[i] shifted by (array[offset+i] mod 26)
	end
	return encoded_string
end


Example:
encode("solution", 101, 10^5) returns "bvktehbs"

[My timing: <1m]