The below code snippet can help to determine the DBR Hash string for the DBR version. DBR hash string is unique for the DBR minor version.
val scalaVersion = scala.util.Properties.versionString
val hadoopVersion = org.apache.hadoop.util.VersionInfo.getVersion
val baseVersion = org.apache.spark.BuildInfo.sparkBranch
val baseSha = org.apache.spark.BuildInfo.apacheBase
val dbrSha = org.apache.spark.BuildInfo.gitHash
val universeSha = com.databricks.BuildInfo.gitHash
val universeTimestamp = com.databricks.BuildInfo.gitTimestamp
val imageId = spark.conf.get("spark.databricks.clusterUsageTags.sparkVersion")