There are many possibilities. The first that cam to mind was to preserve the first and last characters and pick random values for the rest but that seemed a bit silly. So here is something a little more sensible.
function conv(A,a,b){
for(var B='', i=0; i<A.length; i++){
var d=a.charCodeAt(i%a.length)-b.charCodeAt(i%b.length);
B+=String.fromCharCode( d+A.charCodeAt(i));
}
return B;
}
The function take a pattern to be converted $A$ and two sample patterns $a$ and $b$.
It calculates the difference in ASCII values of pairs of sample characters and apply it to characters of the pattern to be converted.
In cases such as the example where the pattern to convert is longer than the sample it returns to beginning of the sample for more characters.
The result looks a bit of a mess and highlights the problems that may occur with this method.
LRGGb5Z\EWIL