Converting magnitude to dBs
They are both valid:


$10 \cdot \log_{10}$ is for power ratios
$20 \cdot \log_{10}$ is for voltage/pressure/etc ratios (these are called "field quantities" or "root-power quantities")


See Field, power, and root-power quantities and Decibel definition

Digital values are just unitless numbers, so you need to think about what they ultimately represent.  Typically they're root-power quantities (like audio pressure waveforms), but could conceivably represent power waveforms.