$D$-Magic and Antimagic Labelings of Hypercubes