Facebook
From test, 2 Weeks ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 120
  1. # Chemin vers le fichier contenant la première ligne du fichier hexadécimal
  2. $cheminFichierHexa = "chemin/vers/le/fichier.txt"
  3.  
  4. # Lire la première ligne du fichier hexadécimal
  5. $premiereLigneHexa = Get-Content -Path $cheminFichierHexa -TotalCount 1
  6.  
  7. # Convertir la première ligne hexadécimale en décimal
  8. $decimal = [System.Convert]::ToInt64($premiereLigneHexa, 16)
  9.  
  10. # Convertir le nombre décimal en binaire
  11. $binaire = [System.Convert]::ToString($decimal, 2)
  12.  
  13. # Définir la taille des blocs de bits
  14. $tailleBloc = 64
  15.  
  16. # Regrouper les bits en blocs de 64 bits
  17. $blocs = @()
  18. for ($i = 0; $i -lt $binaire.Length; $i += $tailleBloc) {
  19.     $bloc = $binaire.Substring($i, [Math]::Min($tailleBloc, $binaire.Length - $i))
  20.     $blocs += $bloc
  21. }
  22.  
  23. # Afficher les blocs de bits
  24. foreach ($bloc in $blocs) {
  25.     Write-Host $bloc
  26. }
  27.