# Why OpenSSH private key files differ after restoration

DevFeed: [Why OpenSSH private key files differ after restoration](<https://devfeed.tech/articles/marshaling-ssh-private-keys-why-there-s-always-a-different-block-37851.md>)

Original publisher: [Read original article](<https://carlosbecker.com/posts/ssh-marshal-private-key/>)

Author: Carlos Alexandro Becker

Published: 2022-12-20T00:00:00Z

Content type: tutorial

Language: en

Sources: [Carlos Becker](<https://devfeed.tech/sources/carlos-becker.md>)

Topics: [OpenSSH](<https://devfeed.tech/topics/openssh.md>), [private key](<https://devfeed.tech/topics/private-key.md>), [Go](<https://devfeed.tech/topics/go.md>), [Code](<https://devfeed.tech/topics/code.md>), [C](<https://devfeed.tech/topics/c.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [go](<https://devfeed.tech/tags/go.md>), [openssh](<https://devfeed.tech/tags/openssh.md>), [private-key](<https://devfeed.tech/tags/private-key.md>), [ssh](<https://devfeed.tech/tags/ssh.md>)

## AI overview

This article investigates why restoring an SSH private key and marshaling it back to OpenSSH private-key format produces a different block. It explains that duplicated random values in the encrypted format allow successful decryption to be checked, while the restored keys can still represent the same key.

## Source excerpt

Not long ago, when I was building melt, I learned something interesting.