TITLE: proving algorithm to check if two strings are anagrams-
QUESTION [6 upvotes]: I have this idea (using C language) for checking for two string if they are anagrams-

if the length of the strings is the same (its only a-z and A-Z).
sum of ASCII value of all chars in a string is the same for both strings.
multiplication of ASCII value of all chars in a string is the same for both strings.

I believe that if all three are correct it must be an anagram but I cannot prove it.. since I have no math background.. can any one prove it or contradict it?
(other solutions for this problem are not necessery)

REPLY [9 votes]: A minimal counterexample is "BPT" (ASCII $66$, $80$, $84$) and "FHX" (ASCII $70$, $72$, $88$).  They're the same length, the sums are both $230$, and the products are both $443520$.  As mentioned in the other answer, you will probably need all $n$ symmetric functions of the ASCII codes to correctly identify all non-anagrammatic pairs of length $n$.  For instance, for $n=3$, in addition to $x_1+x_2+x_3$ and $x_1 x_2 x_3$, you can include $x_1 x_2 + x_1 x_3 + x_2 x_3$ in your "key".