{VERSION 6 0 "IBM INTEL LINUX" "6.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 1 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Heading 1" 0 3 1 {CSTYLE "" -1 -1 "" 1 18 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }1 0 0 0 8 4 0 0 0 0 0 0 -1 0 }{PSTYLE "Author" 0 19 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }3 0 0 -1 8 8 0 0 0 0 0 0 -1 0 }{PSTYLE "" 3 256 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }3 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }} {SECT 0 {EXCHG {PARA 256 "" 0 "" {TEXT -1 47 "Parsing text into r-digi t numbers to given base" }}{PARA 19 "" 0 "" {TEXT -1 55 "Mike O'Sulliv an\nSan Diego State University\nJanuary 2005" }}}{EXCHG {PARA 0 "" 0 " " {TEXT -1 87 " With some cryptosystems it is useful to combine severa l letters into a single number." }}{PARA 0 "" 0 "" {TEXT -1 96 "If th ere are N letters in the alphabet, we may combine r of these letters t o produce an integer " }}{PARA 0 "" 0 "" {TEXT -1 68 "between 0 and N^ r. The letters x_\{r-1\}, ...,x_0 become the integer " }}{PARA 0 "" 0 "" {TEXT -1 30 "x_\{r-1\}*N^\{r-1\}+...+x_1*N +x_0" }}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 14 "The procedures" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 96 "These following two proce duress allow us to take a list of numbers between 0 and N and produce \+ a" }}{PARA 0 "" 0 "" {TEXT -1 107 "Vector that will be input to a cry ptosystem. Parse_rgraphs() takes as input the list of numbers, p_nums ; " }}{PARA 0 "" 0 "" {TEXT -1 245 " the base, N and the number of di gits, r, in which the vector components are to be written. We assume that the entries in p_nums are nonnegative integers less than N. Th e output of Psrse_rgraphs() is a Vector of integers between 0 and N^r ." }}{PARA 0 "" 0 "" {TEXT -1 1 "." }}{PARA 0 "" 0 "" {TEXT -1 179 "Th e reverse procedure is Decompose_rgraphs() which takes a vector--whose components are positive integers less than N^r-- and returns a list o f positive integers all less than N. " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 375 "Parse_rgraphs := proc (p_nums, N, r) \nlocal i, j, k , len, p_vec, new_digit; \n\nlen := ceil(nops(p_nums)/r); #Find the \+ \np_vec := Vector(len); \nk := 0; \nfor i to len do \n k := (i-1)*r; \n for j to r do \n if k+j <= nops(p_nums) then \n new_d igit := p_nums[k+j] \n else new_digit := 0 end if; \n p_vec[i] : = p_vec[i]*N+new_digit \n od; \nod;\nRETURN(p_vec); \nend;" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 366 "Decompose_rgraphs := proc ( d_vec, N, r) \nlocal i, j, temp_list, d_nums, temp; \n\nd_nums := []; \+ \ntemp_list := [seq(0,i = 1 .. r)]; \nfor i to LinearAlgebra[Dimension ](d_vec) do \n temp := d_vec[i]; \n for j from 0 to r-1 do \n \+ temp_list[r-j] := irem(temp,N); \n temp := iquo(temp,N);\n od ; \n d_nums := [op(d_nums), op(temp_list)];\nod;\nRETURN(d_nums);\ne nd;" }}}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 7 "Example" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 46 "h:=[12, 3, 12, 43, 54, 66, 54, 67, 82, 45,12];" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "Parse_rgraphs(h, 100,2);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 27 "Decompose_ngraphs(%,100,2);" }}}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{MARK "6" 0 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }