{"id":42457969,"url":"https://github.com/wmnsk/milenage","last_synced_at":"2026-01-28T09:08:28.418Z","repository":{"id":52413070,"uuid":"161309138","full_name":"wmnsk/milenage","owner":"wmnsk","description":"MILENAGE algorithm implemented in the Go Programming Language.","archived":false,"fork":false,"pushed_at":"2025-04-25T18:02:21.000Z","size":72,"stargazers_count":13,"open_issues_count":2,"forks_count":6,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-25T19:20:11.386Z","etag":null,"topics":["epc","eutran","lte","milenage","security","telecom"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wmnsk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-12-11T09:24:54.000Z","updated_at":"2025-04-25T18:02:09.000Z","dependencies_parsed_at":"2023-11-15T03:28:05.307Z","dependency_job_id":"5379ef0c-d6e8-489e-8b6b-5801f5e554dd","html_url":"https://github.com/wmnsk/milenage","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/wmnsk/milenage","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wmnsk%2Fmilenage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wmnsk%2Fmilenage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wmnsk%2Fmilenage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wmnsk%2Fmilenage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wmnsk","download_url":"https://codeload.github.com/wmnsk/milenage/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wmnsk%2Fmilenage/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28843199,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T07:39:25.367Z","status":"ssl_error","status_checked_at":"2026-01-28T07:39:24.487Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["epc","eutran","lte","milenage","security","telecom"],"created_at":"2026-01-28T09:08:26.491Z","updated_at":"2026-01-28T09:08:28.411Z","avatar_url":"https://github.com/wmnsk.png","language":"Go","funding_links":[],"categories":["Protocols"],"sub_categories":["NAS 4G/5G and Milenage"],"readme":"# MILENAGE\r\n\r\nMILENAGE algorithm implemented in the Go Programming Language.\r\n\r\n[![CI status](https://github.com/wmnsk/milenage/actions/workflows/go.yml/badge.svg)](https://github.com/wmnsk/milenage/actions/workflows/go.yml)\r\n[![golangci-lint](https://github.com/wmnsk/milenage/actions/workflows/golangci-lint.yml/badge.svg)](https://github.com/wmnsk/milenage/actions/workflows/golangci-lint.yml)\r\n[![Go Reference](https://pkg.go.dev/badge/github.com/wmnsk/milenage.svg)](https://pkg.go.dev/github.com/wmnsk/milenage)\r\n[![GitHub](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/wmnsk/milenage/blob/main/LICENSE)\r\n\r\n## Quickstart\r\n\r\nInitialize Milenage first with K, OP, RAND, SQN, and AMF.\r\n\r\n```go\r\nmil := milenage.New(\r\n\t// K\r\n\t[]byte{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff},\r\n\t// OP\r\n\t[]byte{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff},\r\n\t// RAND\r\n\t[]byte{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff},\r\n\t0x000000000001, // SQN\r\n\t0x8000,         // AMF\r\n)\r\n```\r\n\r\nOr, with OPc.\r\n\r\n```go\r\nmil := milenage.NewWithOPc(\r\n\t// K\r\n\t[]byte{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff},\r\n\t// OPc\r\n\t[]byte{0x62, 0xe7, 0x5b, 0x8d, 0x6f, 0xa5, 0xbf, 0x46, 0xec, 0x87, 0xa9, 0x27, 0x6f, 0x9d, 0xf5, 0x4d},\r\n\t// RAND\r\n\t[]byte{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff},\r\n\t0x000000000001, // SQN\r\n\t0x8000,         // AMF\r\n)\r\n```\r\n\r\nGet MAC-A and MAC-S. This also fills each field.\r\n\r\n```go\r\nmacA, err := mil.F1()\r\nif err != nil {\r\n\t// ...\r\n}\r\n\r\nmacS, err := mil.F1Star()\r\nif err != nil {\r\n\t// ...\r\n}\r\n```\r\n\r\nGet RES, CK, IK, AK. This also fills each field.\r\n\r\n```go\r\nres, ck, ik, ak, err := mil.F2345()\r\nif err != nil {\r\n\t// ...\r\n}\r\n```\r\n\r\nGet RES* for 5G with `ComputeRESStar()` by giving MCC and MNC.\r\n\r\n```go\r\nresStar, err := mil.ComputeRESStar(\"001\", \"01\")\r\nif err != nil {\r\n\t// ...\r\n}\r\n```\r\n\r\nGet OPc from K and OP. This is not the method on `*Milenage`. An example program can be found [here](./examples/compute_opc).\r\n\r\n```go\r\nopc, err := milenage.ComputeOPc(\r\n\t[]byte{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff},\r\n\t[]byte{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff},\r\n)\r\nif err != nil {\r\n\t// ...\r\n}\r\n```\r\n\r\nGet AUTN and AUTS which are used in authentication procedure.\r\nBe sure that the required calculation has done before calling these methods.\r\n\r\n```go\r\nautn, err := mil.GenerateAUTN()\r\nif err != nil {\r\n\t// ...\r\n}\r\n\r\n// Note that this re-calcurates MAC-S and AKS with AMF=0x0000\r\n// as described in 6.3.3, TS 33.102.\r\nauts, err := mil.GenerateAUTS()\r\nif err != nil {\r\n\t// ...\r\n}\r\n```\r\n\r\nFill all fields(except 5G RES*) at once using `ComputeAll()`.\r\nBe sure that this uses the bare AMF value in `*Milenage` and the MAC-S value might be a unwanted one.\r\nCall each function with the right parameters to get the right values.\r\n\r\n```go\r\nif err := mil.ComputeAll(); err != nil {\r\n\t// ...\r\n}\r\n```\r\n\r\n## Notes\r\n\r\nThis implementation may not pass _all_ of the test cases defined in TS 35.207 because it contains a case\r\nwhose payload to compute is not aligned to byte, which I believe won't happen in the real-world implementation as of 2022.\r\n\r\n## Author\r\n\r\nYoshiyuki Kurauchi ([Website](https://wmnsk.com/) / [Twitter](https://twitter.com/wmnskdmms))\r\n\r\n## License\r\n\r\n[MIT](https://github.com/wmnsk/milenage/blob/main/LICENSE)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwmnsk%2Fmilenage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwmnsk%2Fmilenage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwmnsk%2Fmilenage/lists"}