function result = crypt(txt, seed, forward) if nargin < 3 forward = true; end if forward sign = +1; else sign = -1; end rand('state', seed); loch = 33; hich = 126; range = hich+1-loch; rn = floor(range * rand(1, length(txt) ) ); change = (txt >= loch) & (txt <= hich); result = txt; result(change) = loch + mod(result(change) + sign*rn(change) - loch, range);