View Raw SPL
/*****************************************************************************
* *
* R3THANKS.SPL Copyright (C) 2012 DSP Development Corporation *
* All Rights Reserved *
* *
* Author: Randy Race *
* *
* Synopsis: Displays a decoded message *
* *
* Revisions: 16 Dec 2012 RRR Creation *
* *
*****************************************************************************/
#if @HELP_R3THANKS
R3THANKS
Purpose: Displays a decoded message.
Syntax: R3THANKS(cipher)
cipher - Optional. A series, the cipher required to decode
the message.
Returns: If a cipher is provided, the encoded data is decoded using the
cipher and the resulting message is displayed.
mes = R3THANKS(cipher) returns the decoded message as a string.
If no cipher is provided, the encoded source series is returned.
Example:
R3THANKS()
returns the original encoded data.
Example:
R3THANKS({100, 200, 300, 400})
displays an incorrectly decoded message.
Remarks:
The series {1958, 1, 11} is a particularly useful cipher.
See Also:
Deconv
Message
Strchars
#endif
/* private message */
r3thanks(cipher)
{
/*
* A note of thanks to all you loyal DADiSP users out there. Without
* your tremendous support and feedback, DADiSP simply would not be
* possible. DADiSP continues to be a rewarding labor of love and
* perhaps a bit like me, it's a project that's never quite finished,
* but hopefully forever moving forward.
*
* - RRR
*/
local usr, mes, rrr = {{164472, 203716, 206618, 226419, 063926, 206887},
{225627, 063926, 214719, 237379, 063976, 195205},
{217789, 216580, 232375, 218666, 212873, 230415},
{228433, 199161, 197177, 063867, 228260, 204100},
{191306, 216621, 210683, 226487, 063948, 228425},
{217806, 064043, 238171, 217811, 230528, 063994},
{201035, 217792, 224445, 063991, 191212, 211913},
{212639, 063952, 238138, 217811, 230528, 224550},
{064057, 226456, 229553, 220678, 220695, 218682},
{224555, 228463, 065984, 020889, 019953, 062776},
{062798, 063040, 063040, 063040, 088494, 063053},
{063183, 160940, 160990, 161540, 000984, 000902}};
if (argc < 1)
{
/* return encoded table */
return(rrr);
}
/* make sure cipher is a series */
cipher = {cipher};
/* convert encoded table to a single column series */
rrr = unravel(transpose(rrr));
/* decode via deconvolution and convert to a string */
mes = strchars(round(deconv(rrr, cipher)));
if (outargc > 0)
{
/* return message */
return(mes);
}
else
{
/* display message, verify checksum */
usr = (sum(charstrs(mes)) == 5962) ? gethostid(1) : "Incorrect Cipher";
message(usr, mes);
}
}