Plan 9 from Bell Labs’s /usr/web/sources/contrib/steve/root/sys/src/cmd/cvsfs/mangle.c

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


/* password "encryption" */

char *
mangle(char *str)
{
	char *s;

	char subs[] = {
	['!'] 120, ['"']  53, ['%'] 109, ['&']  72, ['''] 108, ['('] 70,
	[')']  64, ['*']  76, ['+']  67, [','] 116, ['-']  74, ['.'] 68,
	['/']  87, ['0'] 111, ['1']  52, ['2']  75, ['3'] 119, ['4'] 49,
	['5']  34, ['6']  82, ['7']  81, ['8']  95, ['9']  65, [':'] 112,
	[';']  86, ['<'] 118, ['='] 110, ['>'] 122, ['?'] 105, ['A'] 57,
	['B']  83, ['C']  43, ['D']  46, ['E'] 102, ['F']  40, ['G'] 89, 
	['H']  38, ['I'] 103, ['J']  45, ['K']  50, ['L']  42, ['M'] 123, 
	['N']  91, ['O']  35, ['P'] 125, ['Q']  55, ['R']  54, ['S'] 66, 
	['T'] 124, ['U'] 126, ['V']  59, ['W']  47, ['X']  92, ['Y'] 71, 
	['Z'] 115, ['_']  56, ['a'] 121, ['b'] 117, ['c'] 104, ['d'] 101,
	['e'] 100, ['f']  69, ['g']  73, ['h']  99, ['i']  63, ['j'] 94,
	['k']  93, ['l']  39, ['m']  37, ['n']  61, ['o']  48, ['p'] 58,
	['q'] 113, ['r']  32, ['s']  90, ['t']  44, ['u']  98, ['v'] 60,
	['w']  51, ['x']  33, ['y']  97, ['z']  62,
	};

	for (s = str; *s; s++)
		*s = subs[*s];
	return str;
}


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].