* chore(deps): bump github.com/kovidgoyal/imaging from 1.8.7 to 1.8.19 Bumps [github.com/kovidgoyal/imaging](https://github.com/kovidgoyal/imaging) from 1.8.7 to 1.8.19. - [Release notes](https://github.com/kovidgoyal/imaging/releases) - [Commits](https://github.com/kovidgoyal/imaging/compare/v1.8.7...v1.8.19) --- updated-dependencies: - dependency-name: github.com/kovidgoyal/imaging dependency-version: 1.8.19 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * chore(deps): bump golang.org/x/net from 0.48.0 to 0.49.0 Bumps [golang.org/x/net](https://github.com/golang/net) from 0.48.0 to 0.49.0. - [Commits](https://github.com/golang/net/compare/v0.48.0...v0.49.0) --- updated-dependencies: - dependency-name: golang.org/x/net dependency-version: 0.49.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> # Conflicts: # go.mod * chore(deps-dev): bump @babel/runtime in /services/idp Bumps [@babel/runtime](https://github.com/babel/babel/tree/HEAD/packages/babel-runtime) from 7.28.2 to 7.28.6. - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.28.6/packages/babel-runtime) --- updated-dependencies: - dependency-name: "@babel/runtime" dependency-version: 7.28.6 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
36 lines
879 B
Go
36 lines
879 B
Go
package shm
|
|
|
|
import (
|
|
"crypto/rand"
|
|
"encoding/base32"
|
|
"fmt"
|
|
not_rand "math/rand/v2"
|
|
"strconv"
|
|
"unsafe"
|
|
)
|
|
|
|
var _ = fmt.Print
|
|
|
|
func RandomFilename() string {
|
|
b := []byte{0, 0, 0, 0, 0, 0, 0, 0}
|
|
_, err := rand.Read(b)
|
|
if err != nil {
|
|
return strconv.FormatUint(uint64(not_rand.Uint32()), 16)
|
|
}
|
|
return base32.StdEncoding.WithPadding(base32.NoPadding).EncodeToString(b)
|
|
}
|
|
|
|
// Unsafely converts s into a byte slice.
|
|
// If you modify b, then s will also be modified. This violates the
|
|
// property that strings are immutable.
|
|
func UnsafeStringToBytes(s string) (b []byte) {
|
|
return unsafe.Slice(unsafe.StringData(s), len(s))
|
|
}
|
|
|
|
// Unsafely converts b into a string.
|
|
// If you modify b, then s will also be modified. This violates the
|
|
// property that strings are immutable.
|
|
func UnsafeBytesToString(b []byte) (s string) {
|
|
return unsafe.String(unsafe.SliceData(b), len(b))
|
|
}
|