RUST Affine cipher exercise - tests correct?

This exercise has an error code for keys that are not co-prime. But the “OMG” test uses keys 21,3 and tests for an encoded string. Surely this should result in a not coprime error?

The test is encoded like that in the shared problem specifications, which means that if this were a bug in Rust, it would be a bug in all tracks that have implemented this.

Why do you “surely” expect this to result in a not coprime error?

The hint here is that b is not a value to be checked against the coprimality, but a is, as is the alphabet’s length, as described in the

Values a and m must be coprime

Yes, that is right, I am dumb. Didnt read the requirements carefully and assumed the whole key had to be co-prime . . .

1 Like

Thanks for asking this question. You saved me from revealing that I made the same error.