#name #package #family #applications #calculating #calculate #msix

no-std package-family-name

Library for calculating MSIX Package Family Name values

2 stable releases

1.1.0 Dec 13, 2023
1.0.0 Dec 5, 2023

#117 in No standard library

Download history 175/week @ 2024-02-26 95/week @ 2024-03-04 177/week @ 2024-03-11 198/week @ 2024-03-18 141/week @ 2024-03-25 175/week @ 2024-04-01 202/week @ 2024-04-08 88/week @ 2024-04-15 55/week @ 2024-04-22 282/week @ 2024-04-29 261/week @ 2024-05-06 205/week @ 2024-05-13 96/week @ 2024-05-20 53/week @ 2024-05-27 59/week @ 2024-06-03 70/week @ 2024-06-10

281 downloads per month
Used in komac

MIT/Apache

7KB

Package Family Name

Test Status

A Rust library for calculating MSIX Package Family Name values.

This is a #![no_std] library.

Every MSIX application has a package family name value, which looks a bit like AppName_zj75k085cmj1a. This value can easily be found by running Get-AppxPackage <name> in PowerShell for an installed MSIX package and scrolling to PackageFullName.

However, we can work out a package family name value without needing to install the package at all. That's where this library comes into play.

Usage

Add this to your Cargo.toml:

[dependencies]
package-family-name = "1.0"

This library currently only has one function, get_package_family_name, that takes in an identity name and an identity publisher:

let package_family_name = get_package_family_name("AppName", "Publisher Software"); // AppName_zj75k085cmj1a

How a package family name is calculated

In short, a package family name is made up of two parts:

  • Identity name (AppName)
  • Identity publisher (Publisher Software)

These steps are then taken:

  1. UTF-16 encode the identity publisher
  2. Calculate a SHA256 hash of the encoded publisher
  3. Take the first 8 bytes of the hash
  4. Encode the result with Douglas Crockford Base32
  5. Join the identity name and the encoded value with an underscore (AppName_zj75k085cmj1a)

Why would I need to calculate a package family name?

Whilst this is a niche library, there are use cases. For example, when submitting an MSIX package to winget-pkgs, a package family name value is a required as part of the manifest.

Acknowledgements

@marcinotorowski has produced a step by step explanation of how to calculate the hash part of the package family name. This post can be found here.

License

Licensed under either of:

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~630KB
~13K SLoC