All Android devices support SHA-256. The NoSuchAlgorithmException
indicates that a requested algorithm could not be found and is necessary because the method takes a String
argument for the algorithm name. If you passed in “foo-256”, the method’s only recourse is to throw a NoSuchAlgorithmException
because, for reasons beyond my understanding, there’s no algorithm called “foo-256”. Assuming you’re passing in a name you’re sure is an algorithm that Android can use, you’ll never see that exception.