All pastes #15602 Raw Edit

Unnamed

public c v1 · immutable
#15602 ·published 2005-06-22 22:45 UTC
rendered paste body
char rot13c(char c){	/*The simple Caesar-cypher encryption that replaces each English letter with the one 13 places 	forward or back along the alphabet, so that "The butler did it!" becomes "Gur ohgyre qvq vg!" 	Most Usenet news reading and posting programs include a rot13 feature. It is used to enclose 	the text in a sealed wrapper that the reader must choose to open - e.g. for posting things that	might offend some readers, or spoilers. A major advantage of rot13 over rot(N) for other N is that	it is self-inverse, so the same code can be used for encoding and decoding.*/	//and thanx to mydoom for showing me what it was in the first place.	char u[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";	char l[] = "abcdefghijklmnopqrstuvwxyz";	char *p;	if ((p = strchr(u, c)) != NULL)		return u[((p-u) + 13) % 26];	else if ((p = strchr(l, c)) != NULL)		return l[((p-l) + 13) % 26];	else		return c;}void rot13(char *buf, const char *in){	while (*in)		*buf++ = rot13c(*in++);	*buf = 0;}