• Caesar cypher function (https://en.wikipedia.org/wiki/Caesar_cipher)

    Returns the encoding of aStr after a rotation of size offset. aStr is supposed to be a string composed uniquely from a-z characters.

    Parameters

    • aStr: string

      the string to cypher

    • anOffset: number

      the rotation to apply

    Returns string

    the cyphered string

    cypherCaesar(’abcde’, 1);  // -> ’bcdef’
    cypherCaesar(’bcdef’, -1); // -> ’abcde’
    cypherCaesar(’abcde’, 13); // -> ’nopqr’
    cypherCaesar(’nopqr’, 13); // -> ’abcde’