Helper function as NSData category