MATLAB: How to convert an image for AES algorithm in Hexadecimal format input

aes algorithmbyte to hexadecimal conversioncryptographydata conversionimage to hexadecimal conversion

I know how to convert the file in byte format by using
fid = fopen(FileName, 'r');
if fid == -1, error('Cannot open file'); end
data = fread(fid, Inf, '*uint8');
fclose(fid);
But I want the file in hexadecimal format. How to convert it in hexadecimal format??? If I use dec2hex then the size of the file is too much so i cannot use this. So, how to convert file in hexadecimal for AES.
Plz… help….thanx.

Best Answer

datahex = sprintf('%02x', data);