An optical-based encryption and authentication algorithm for color and grayscale medical images