Al Chu wrote: > Here's an idea. How about if the user prefixes his input with a '0x', > then we assume the user wants to do up to 20 bytes of hex. If not > prefixed by '0x', then we assume the user is inputting a string?
You could use the syntax that's used for specifying WEP keys in iwconfig: The key is interpreted as hex (with optional '-' delimiters) unless it is prefixed with 's:'. E.g. "s:password" would be equivalent to "7061-7373-6f72-640a". > This would lead to some difficulty with the checkout of the K_g. We > would have to add some logic to check on hex vs. string. At the minimum > we'd have to check if all of the bytes after the first NULL byte are > also NULL. Perhaps some logic checks to ascii character ranges is > needed too? Hmmm ... All characters up to the first '\0' should be printable (function isprint()), all subsequent characters must be '\0'. Otherwise you should fall back to hex syntax to be on the safe side. Maybe non-ascii characters (>127) should be forbidden as well to avoid character encoding problems. Cheers, Ingo _______________________________________________ Freeipmi-devel mailing list Freeipmi-devel@gnu.org http://lists.gnu.org/mailman/listinfo/freeipmi-devel