rewrite to use file2key

Signed-off-by: Mattias Andrée <maandree@operamail.com>