sha1-name: check for overflow of N in "foo^N" and "foo~N"