2 Samuel 22:27
With the pure thou wilt shew thyself pure; and with the froward thou wilt shew thyself unsavoury.
Cross-reference
Psalm 18:26 is the identical verse from the parallel song, confirming the same principle of God responding in kind.
Psalm 125:5 says God leads away the crooked with evildoers—directly reflecting David's assertion that God deals tortuously with the crooked.
Matthew 5:8 blesses the pure in heart who see God—echoing David's statement that God shows Himself pure to the pure.
Leviticus 26:24 states God will walk contrary to those who walk contrary to Him — a clear covenant parallel to God showing Himself twisted to the crooked.
Leviticus 26:23-28 details escalating punishments for the obstinate—matching David's image of God turning tortuous toward the crooked.
Deuteronomy 28:58-61 threatens severe plagues for covenant unfaithfulness—paralleling God's harsh response to the crooked in David's song.