code: private void writePassword(String resource, String password) throws IOException {
      String[] resourceParts = resource.split("\\$MD5\\$");
      if (resourceParts.length == 1) {
        // Write in clean
        outputStream.write(password);
      } else {
        outputStream.write("$MD5$" + SanePasswordEncoder.derivePassword(resourceParts[1], password));
      }
    }
docs: Write password to outputstream depending on resource provided by saned.
  
  @param resource as provided by sane in authorization request
  @param password
  @throws IOException