It’s all too easy these days to be duped by a fake photo that has been altered using Photoshop. But a new technique could catch out the photo fakers.

The algorithm identifies inconsistent shadows that are not always obvious to the naked eye.

University of California, Berkley scientist James O’Brien teamed up with Hany Farid and Eric Kee of Dartmouth University to develop the algorithm that interprets a variety of shadows in an image to determine if they are physically consistent with a single light source.

"We draw a wedge from the shadow where the wedge includes the whole object. We know that the line would have to be in that wedge somewhere. We then keep drawing wedges, extending them beyond the edges of the image," said O’Brien.

If the photo is authentic, then all of the wedges have a common intersection region where the light source is.

The team has used the theory to prove that the much disputed iconic photo of Buzz Aldrin on the moon taken in 1969 is, in fact, real.

"The shadows go in all kinds of different directions and the lighting’s very strange… but if you do the analysis, it all checks out," O’Brien said.

National security agencies and the media will be able to use the digital forensic technique to differentiate between authentic images and computerized forgeries.